Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

Switch_lock Class Reference

A lock that implements priority inheritance. More...

#include <switch_lock.h>

List of all members.

Public Member Functions

void initialize ()
 Initialize Switch_lock.
Contextlock_owner () const
 Lock owner.
bool test () const
 Is lock set?.
void lock ()
 Acquire the lock with priority inheritance.
bool test_and_set ()
 Acquire the lock with priority inheritance.
void clear ()
 Free the lock.

Private Member Functions

bool try_lock ()
 Try to acquire the lock.

Private Attributes

Context_lock_owner


Detailed Description

A lock that implements priority inheritance.


Member Function Documentation

void Switch_lock::clear  ) 
 

Free the lock.

Return the CPU to helper if there is one, since it had to have a higher priority to be able to help (priority may be its own, it may run on a donated timeslice or round robin scheduling may have selected a thread on the same priority level as me)

void Switch_lock::initialize  )  [inline]
 

Initialize Switch_lock.

Call this function if you cannot guarantee that your Switch_lock instance is allocated from zero-initialized memory.

void Switch_lock::lock  ) 
 

Acquire the lock with priority inheritance.

If the lock is occupied, enqueue in list of helpers and lend CPU to current lock owner until we are the lock owner.

Context * Switch_lock::lock_owner  )  const [inline]
 

Lock owner.

Returns:
current owner of the lock. 0 if there is no owner.

bool Switch_lock::test  )  const [inline]
 

Is lock set?.

Returns:
true if lock is set.

bool Switch_lock::test_and_set  )  [inline]
 

Acquire the lock with priority inheritance.

Returns:
true if we owned the lock already. false otherwise.

bool Switch_lock::try_lock  )  [inline, private]
 

Try to acquire the lock.

Returns:
true if successful: current context is now the owner of the lock. false if lock has previously been set. Returns false even if the current context is already the lock owner.


Member Data Documentation

Context* Switch_lock::_lock_owner [private]
 


The documentation for this class was generated from the following files:
Generated on Mon Sep 26 14:20:17 2005 for Fiasco by  doxygen 1.4.2