rc_mutex_object Class Reference

#include <rc_mutex_object.h>

List of all members.


Detailed Description

Implementation of a mutex object.

rc_mutex_object is ReChannl's light-weight mutex implementation. sc_mutex and its interface sc_mutex_if is not appropriate for an internally used helper class.

Definition at line 50 of file rc_mutex_object.h.


Public Member Functions

 rc_mutex_object ()
bool trylock ()
 Try to lock the mutex for the current process.
void lock ()
 Lock the mutex for the current process.
bool lock (sc_time timeout)
 Lock the mutex for the current process (with timeout).
bool unlock ()
 Unlock the mutex for the current process.
bool has_lock () const
 Does the current process hold a lock?
bool is_locked () const
 Is this mutex locked by a process?
const sc_event & get_lock_release_event () const
 The lock release event.

Protected Member Functions

bool is_lock_owner (const sc_process_handle &hproc) const
 Does the given process hold a lock?

Protected Attributes

sc_process_handle m_lock_owner
 the process currently holding a lock on this mutex
int m_lock_count
 the number of locks on this mutex
sc_event m_lock_release_event
 the event that is notified if a lock is released

Private Member Functions

 rc_mutex_object (const rc_mutex_object &orig)
const rc_mutex_objectoperator= (const rc_mutex_object &orig)

Constructor & Destructor Documentation

rc_mutex_object (  ) 

Definition at line 41 of file rc_mutex_object.cpp.

rc_mutex_object ( const rc_mutex_object orig  )  [private]


Member Function Documentation

bool trylock (  ) 

Try to lock the mutex for the current process.

Tries to lock the mutex for the current process. trylock() is non-blocking and returns immediately.

Returns:
true if succeeded, false otherwise

Definition at line 45 of file rc_mutex_object.cpp.

Referenced by rc_reconfigurable::trylock().

void lock (  ) 

Lock the mutex for the current process.

Waits until a lock for the current process can be acquired.

Definition at line 59 of file rc_mutex_object.cpp.

Referenced by rc_reconfigurable::lock(), and rc_reconfigurable::reconfigure().

bool lock ( sc_time  timeout  ) 

Lock the mutex for the current process (with timeout).

Waits until a lock for the current process can be acquired. timeout is specified to cancel waiting after this delay.

Returns:
true if lock was acquired, false if the timeout occured.

Definition at line 77 of file rc_mutex_object.cpp.

bool unlock (  ) 

Unlock the mutex for the current process.

Unlocks the mutex for the current process. unlock() is non-blocking and returns immediately.

Returns:
true if process had previously hold a lock, false otherwise.

Definition at line 101 of file rc_mutex_object.cpp.

Referenced by rc_reconfigurable::reconfigure(), and rc_reconfigurable::unlock().

bool has_lock (  )  const

Does the current process hold a lock?

Returns:
true if hold is locked by current process, false otherwise

Definition at line 121 of file rc_mutex_object.cpp.

Referenced by rc_reconfigurable::has_lock(), rc_reconfigurable::reset_lock_share(), and rc_reconfigurable::share_lock().

bool is_locked (  )  const [inline]

Is this mutex locked by a process?

Returns:
true if this mutex is locked, false otherwise

Definition at line 93 of file rc_mutex_object.h.

Referenced by rc_reconfigurable::is_locked().

const sc_event& get_lock_release_event (  )  const [inline]

The lock release event.

Returns:
the lock release event

Definition at line 99 of file rc_mutex_object.h.

Referenced by rc_reconfigurable::get_lock_release_event().

bool is_lock_owner ( const sc_process_handle &  hproc  )  const [inline, protected]

Does the given process hold a lock?

Parameters:
hproc the process handle
Returns:
true if hold is locked by the given process, false otherwise

Definition at line 123 of file rc_mutex_object.h.

const rc_mutex_object& operator= ( const rc_mutex_object orig  )  [private]


Member Data Documentation

sc_process_handle m_lock_owner [protected]

the process currently holding a lock on this mutex

Definition at line 111 of file rc_mutex_object.h.

Referenced by rc_mutex_object::is_lock_owner(), rc_mutex_object::lock(), rc_mutex_object::trylock(), and rc_mutex_object::unlock().

int m_lock_count [protected]

the number of locks on this mutex

Definition at line 113 of file rc_mutex_object.h.

Referenced by rc_mutex_object::has_lock(), rc_mutex_object::is_locked(), rc_mutex_object::lock(), rc_mutex_object::trylock(), and rc_mutex_object::unlock().

sc_event m_lock_release_event [protected]

the event that is notified if a lock is released

Definition at line 115 of file rc_mutex_object.h.

Referenced by rc_mutex_object::get_lock_release_event(), rc_mutex_object::lock(), and rc_mutex_object::unlock().


The documentation for this class was generated from the following files:
Generated on Tue Jan 1 23:14:15 2008 for ReChannel by  doxygen 1.5.3