priority_mutex


A recursive mutex that guarantees order of obtainment using a fixed-priority scheduling mechanism. The thread with the highest priority acquires a lock on the mutex when it becomes available. Threads with equal priorities acquire locks on a first-in, first-out (FIFO) basis.

Library

Thread<ToolKit>

Declaration

#include <ospace/thread/rpriority.h>

class os_priority_mutex

Typedefs

typedef os_priority_mutex os_recursive_priority_semaphore;

Interface

Constructor
os_priority_mutex( bool locked )
Constructs a mutex with an initial locked (default false ) state.

Throws: os_thread_toolkit_error

Destructor
~os_priority_mutex()
Destroys this mutex.
lock
void lock( int priority )
Acquires a lock, blocking if necessary. If a lock is not immediately available, then schedules the order of obtainment using priority (default 0 ). Multiple locks can be obtained by the same thread.

Throws: os_thread_toolkit_error

obtain
void obtain( int priority )
Synonym for lock() ; alternative acquisition syntax.

Throws: os_thread_toolkit_error

release
void release()
Synonym for unlock() ; alternative acquisition syntax.

Throws: os_thread_toolkit_error

try_lock
bool try_lock()
Attempts to acquire a lock without blocking. Returns true if successful.

Throws: os_thread_toolkit_error

unlock
void unlock()
Releases a single lock. If a thread owns multiple locks, an equal number of unlocks must occur before the mutex becomes available.

Throws: os_thread_toolkit_error


Copyright©1994-2026 Recursion Software LLC
All Rights Reserved - For use by licensed users only.