Macaulay2 » Documentation
Packages » Macaulay2Doc » The Macaulay2 language » Thing » Mutex » tryLock
next | previous | forward | backward | up | index | toc

tryLock -- try locking a mutex

Description

Tries locking a mutex.

i1 : m = new Mutex

o1 = m

o1 : Mutex
i2 : tryLock m

If the mutex is already locked, then an error is raised.

i3 : stopIfError = false

o3 = false
i4 : tryLock m
stdio:4:7:(3):[1]: error: pthread_mutex_trylock: Device or resource busy

See also

Ways to use tryLock:

  • tryLock(Mutex)

For the programmer

The object tryLock is a method function.


The source of this document is in /build/reproducible-path/macaulay2-1.26.05+ds/M2/Macaulay2/packages/Macaulay2Doc/doc_mutex.m2:117:0.