Like mutex but allows timed_lock in addition to lock and try_lock.

Synopsis

Declared in <folly/fibers/TimedMutex.h>

class TimedMutex;

Types

Name

Description

Options

Behavior options for a TimedMutex.

Member Functions

Name

Description

TimedMutex [constructor]

Constructors

~TimedMutex [destructor]

Destroy the mutex, asserting that no waiters remain.

operator=

Assignment operators

co_lock

Lock the mutex asynchronously. The coroutine is suspended until the mutex is free. Unlike lock(), this does not block the OS thread when called from a coroutine context.

co_scoped_lock

Lock the mutex asynchronously, returning an RAII guard that releases the lock when it goes out of scope.

lock

Lock the mutex. The thread / fiber is blocked until the mutex is free.

try_lock

Try to obtain lock without blocking the thread or fiber.

try_lock_for

Lock the mutex. The thread / fiber will be blocked until a timeout elapses.

try_lock_until

Lock the mutex. The thread / fiber will be blocked until a deadline.

unlock

Unlock the mutex and wake up a waiter if there is one.

Created with MrDocs