Regular API function

simSetThreadIsFree / sim.setThreadIsFree

Description Threads created by V-REP are never running concurrently, they rather behave like coroutines. This allows achieving same results as with "pure threads", except when an external command is blocking (e.g. commands not directly supported by V-REP). Those can be lengthly image processing routines, or socket communication routines for example. When such external blocking commands are called, V-REP appears frozen until the external commands return. To avoid such a situation, you can declare a non-blocking section with the sim.setThreadIsFree command: sim.setThreadIsFree(true) starts a non-blocking section, and sim.setThreadIsFree(false) closes it. Try to avoid using V-REP commands when in a non-blocking section (bad synchronization), and never forget to close a non-blocking section, otherwise V-REP will hang indefinitely. Use sim.setThreadIsFree with extra care when calling it from C. A thread running in a non-blocking section cannot be paused nor stopped. This command has no effect when called from the main thread or a non-threaded script.
C synopsis simInt simSetThreadIsFree(simBool freeMode)
C parameters
freeMode: specify 1 to start a non-blocking section. Specify 0 to end a non-blocking section
C return value
1 if operation was successful. In a future release, a more differentiated return value might be available
Lua synopsis number result=sim.setThreadIsFree(Boolean freeMode)
Lua parameters
freeMode: specify true to start a non-blocking section. Specify false to end a non-blocking section
Lua return values
Same as C-function

All regular API functions on one page