Regular API function

simSwitchThread

Description Allows specifying the exact moment at which the current thread should switch to another thread. If the current script doesn't run in a thread (i.e. if it runs in the application main thread), this function has no effect. By default, V-REP doesn't use "regular" threads, but something similar to hybrid threads (which behave like coroutines, but can also behave like regular threads). This allows much more flexibility and execution control of the threads: each thread (except for the main or application thread) has a switch timing associated, which specifies how long the thread will run before switching to other threads. By default this value is 2 millisecond, but can be modified with simSetThreadSwitchTiming. That timing can be shortened with simSwitchThread. Use with care when calling this function from a plugin. See also the simSetThreadAutomaticSwitch, simSetThreadResumeLocation and simSetThreadIsFree functions.
C synopsis simInt simSwitchThread()
C parameters
None
C return value
1 if the thread was switched (the current thread gave control to other threads until the next calculation pass), 0 if it was not switched (e.g. because the function was called from the main or application thread, or from a thread started by the user), or -1 in case of an error.
Lua synopsis number result=simSwitchThread()
Lua parameters
None
Lua return values
result: 1 if the thread was switched (the current thread gave control to other threads until the next calculation pass), 0 if it was not switched (e.g. because the function was called from the main or application thread), or -1 in case of an error.

All regular API functions on one page