Mutex.tryLock

bool tryLock() @trusted

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.

Returns

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.

bool tryLock() shared @trusted

ditto