Mutex.tryLock_nothrow

If the lock is held by another caller, the method returns. Otherwise, the lock is acquired if it is not already held, and then the internal counter is incremented by one.

  1. bool tryLock()
  2. bool tryLock()
  3. bool tryLock_nothrow()
    class Mutex
    final nothrow @trusted @nogc
    bool
    tryLock_nothrow
    (
    this Q
    )
    ()
    if (
    is(Q == Mutex) ||
    is(Q == shared Mutex)
    )

Return Value

Type: bool

true if the lock was acquired and false if not.

Note: Mutex.tryLock does not throw, but a class derived from Mutex can throw. Use tryLock_nothrow in nothrow @nogc code.

Suggestion Box / Bug Report