Regular API function


Description Prepares CoppeliaSim for access to resources. The CoppeliaSim API functions normally automatically protect resources appropriately: when the non-GUI thread reads from or writes to resources, they will be protected (the lock always succeeds). When the GUI thread reads from or writes to resources, the protection might fail (i.e the lock will fail if the non-GUI thread has already locked resources for a longer time), in which case the API function will return with a fail error code. This can be troublesome in case a long succession of API calls is planned. In that case, you should additionally protect the API function calls with one initial call to simLockResources. See also simUnlockResources and sim.getThreadId.
C synopsis simInt simLockResources(simInt lockType,simInt reserved)
C parameters
lockType: the lock type.
reserved: reserved. Set to -1.
C return value
-1 if the lock has failed. Otherwise a lock handle. A locked should always eventually be released, otherwise you will experience a dead-lock or crash.
Lua synopsis -
Lua parameters
Lua return values

All regular API functions on one page