Regular API function

sim.setThreadSwitchAllowed

Description Deprecated. See sim.acquireLock and sim.releaseLock instead
C/C++
synopsis
C/C++
parameters
C/C++
return value
Lua
synopsis
int switchForbidLevel=sim.setThreadSwitchAllowed(bool allowSwitch / int forbidLevel)
Lua
parameters
allowSwitch: if false, then the thread will not be interrupted anymore (i.e. thread switching will be temporarily disabled). Calling n times sim.setThreadSwitchAllowed(false) requires to call n times sim.setThreadSwitchAllowed(true) to restore the initial behaviour.
forbidLevel: allows to set a switch forbid level: a level > 0 indicates that thread interruption is disabled.
Best is to always use following to temporarily forbid thread interruptions:
--lua local initialForbidLevel=sim.setThreadSwitchAllowed(false) -- forbid thread switches ... sim.setThreadSwitchAllowed(initialForbidLevel) -- restore to initial state
Lua
return values
switchForbidLevel: the forbid switch level before calling the function, i.e. the forbid switch level that should be restored later on.
Python
synopsis