RTT::OS::Mutex Class Reference

An object oriented wrapper around a non recursive mutex. More...

#include <rtt/os/Mutex.hpp>

Inheritance diagram for RTT::OS::Mutex:
RTT::OS::MutexInterface

List of all members.

Public Member Functions

 Mutex ()
 Initialize a Mutex.
virtual ~Mutex ()
 Destroy a Mutex.
virtual void lock ()
virtual void unlock ()
virtual bool trylock ()
 Try to lock this mutex.
virtual bool timedlock (Seconds s)
 Lock this mutex, but don't wait longer for the lock than the specified timeout.

Protected Attributes

rt_mutex_t m

Detailed Description

An object oriented wrapper around a non recursive mutex.

A mutex can only be unlock()'ed, by the thread which lock()'ed it. A trylock is a non blocking lock action which fails or succeeds.

Warning:
Mutex instances should only be created in soft realtime, since the initialisation of a mutex can not be done in hard realtime.
See also:
MutexLock, MutexTryLock, MutexTimedLock, MutexRecursive

Definition at line 83 of file Mutex.hpp.


Constructor & Destructor Documentation

virtual RTT::OS::Mutex::~Mutex (  )  [inline, virtual]

Destroy a Mutex.

If the Mutex is still locked, the RTOS will not be asked to clean up its resources.

Definition at line 102 of file Mutex.hpp.


Member Function Documentation

virtual bool RTT::OS::Mutex::timedlock ( Seconds  s  )  [inline, virtual]

Lock this mutex, but don't wait longer for the lock than the specified timeout.

Parameters:
s The maximum time to wait before aqcuiring the lock.
Returns:
true when the locking succeeded, false otherwise

Implements RTT::OS::MutexInterface.

Definition at line 139 of file Mutex.hpp.

References rtos_get_time_ns().

virtual bool RTT::OS::Mutex::trylock (  )  [inline, virtual]

Try to lock this mutex.

Returns:
true when the locking succeeded, false otherwise

Implements RTT::OS::MutexInterface.

Definition at line 125 of file Mutex.hpp.


The documentation for this class was generated from the following file:

Generated on Tue Jul 13 11:03:26 2010 for Orocos Real-Time Toolkit by  doxygen 1.6.1