lock: Lock and unlock a mutex

Description Usage Arguments Details Value Author(s) Examples

Description

The lock and unlock functions allow a user to specify exclusive or shared access to a resource.

Usage

1
2
3

Arguments

m

an object derived from class mutex.

...

options associated with the mutex being used including block which forces the mutex to return immediately after trying to acquire a lock

Details

A call to lock gives exclusive access to a resource; no other mutex may acquire a lock. A call to to lock.shared allows other mutexes to acquire a shared lock on the resource. When shared lock is called while a exclusive lock has been acquired, the shared lock will block until the exclusive lock is release. Likewise, if an exclusive lock is called while a shared lock has been acquired, the exclusive lock will block until the shared lock is released.

Value

The function returns TRUE if the lock is successfully called and FALSE otherwise

Author(s)

Michael J. Kane <bigmemoryauthors@gmail.com>

Examples

1
2
3
4
  m = boost.mutex()
  lock(m)
  # Some code that needs to be synchronized...
  unlock(m)


Search within the synchronicity package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.