Regular API function

sim.setThreadSwitchAllowed

Description Lua only. Allows to temporarily forbid all thread interruptions, including explicit interruptions or switches. For complete control over thread switching, see also the other thread related functions.
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:
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