dbp::mutex Class Reference

Mutually exclusive lock. More...

#include <mutex.h>

Inherits dbp::mutex_int.

List of all members.

Public Member Functions

 mutex ()
 Constructor.
virtual ~mutex ()
 Destructor.
virtual void enter ()
 Enter the protected area.
virtual bool try_enter ()
 Try to enter the protected area.
virtual void leave ()
 Leave the protected area.

Protected Member Functions

virtual void * handle ()

Friends

class event

Detailed Description

Mutually exclusive lock.

This class represents the thread syncronization object, mutex. It is used to prevent access of the resource by executing threads in parallel, providing the atomicy of the code.


Member Function Documentation

virtual void dbp::mutex::enter (  )  [virtual]

Enter the protected area.

When called, no other thread can enter the protected area. These are blocked and wait for releasing of this lock. If the one thread tries to lock same mutex twice, the exception will be thrown.

virtual void dbp::mutex::leave (  )  [virtual]

Leave the protected area.

When called, the lock is releasing; other threads continue to work with ptotected area. The mutex should be unlocked by the same thread which was lock it, or the exception will be thrown.

virtual bool dbp::mutex::try_enter (  )  [virtual]

Try to enter the protected area.

Attempts to enter a protected area without blocking.

Returns:
true, if the protected area is successfully entered or the current thread already owns the mutex.

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

 
Support This Project
SourceForge.net Logo