threadLockEvent() -
creates an object of class
threadLockEvent
to be used as the condition
argument for getLock().
names(threadLockEventTable)
and are provided in the following table.
| Name | Event |
"assign" | any assignment to the object of the given name by another thread |
|---|---|
"remove" | the object is removed from the database. |
"exists" | the object exists in the database. |
Alternatively, this can be supplied as a single numeric value
which is the OR'ing of the values in threadLockEventTable
corresponding the names. This can be used for
efficiency purposes to avoid repeated matching if the
lock is performed regularly, for example in a loop.
The values can be retrieved using
threadLockEventTable[event-name]
where event-name is a string from the table above.
Rather than supplying the numeric values each time,
however,
we recommend that the threadLockEvent object is created
outside the loop using the relevant strings.
threadLockEvent.
threadLock()
getLock()
# will wait until the object "x" is assigned a value
threadLockEvent("x", "assign")
# will wait until the object "messages" exists
threadLockEvent("messages","exists")