CreateLock function (LotusScript® Language)

Finds the lock ID associated with Name. If none exists, the Lock ID is created.


CreateLock( lockName )



String identifier for this particular lock.

Return values

CreateLock will return the lock ID as a simple integer. It will return an error if the platform does not support locks or if there is insufficient shared memory.


Note that the variable the lock ID is stored in is simply an integer. If the variable goes out of scope the ID will be lost. It can be recovered by calling CreateLock again with the same name. Locks are unique across the current shared memory name space. Locks are freed automatically when the thread exits or may be freed by DestroyLock.

Note: When a lock ID is lost DestroyLock cannot be used on the lock and system resources are taken up by the lock until the ID is recovered and the lock destroyed or the agent or thread is exited.

Extended examples: lock functions