Learn R Programming

Rdsm (version 1.1.0)

lock: lock

Description

Classical lock, unlock functions.

Usage

lock(lockname)
unlock(lockname)

Arguments

lockname
Lock variable, quoted.

Details

When a client calls lock() on lockname, Rdsm will check whether lockname is locked. If the lock is unlocked, Rdsm will lock it, and lock() will immediately return. If on the other hand the variable is locked, this client will join the queue for the lock, and its call to lock() will block.

When a client calls unlock(), the call will immediately return. Rdsm will then remove that client from the queue, and will check whether the queue for the lock is still nonempty. If so, then the call to lock() made previously by the new head of the queue will now return.

One does not use newdsm() to create a lock variable. Instead, the variable is automatically created the first time lock() is called on it.

See Also

barr, wait, signal, fa