API Guides > ConceptRT 3.x
Mutex Class Reference

Abstraction of a mutex.A mutex object is used to protect a shared resource from simultaneous access by multiple threads or processes. Each thread must wait for ownership of the mutex before it can execute the code that accesses the shared resource. For example, if several threads share access to a database, the threads can use a mutex object to permit only one thread at a time to write to the database. More...

Detailed Description

Abstraction of a mutex.A mutex object is used to protect a shared resource from simultaneous access by multiple threads or processes. Each thread must wait for ownership of the mutex before it can execute the code that accesses the shared resource. For example, if several threads share access to a database, the threads can use a mutex object to permit only one thread at a time to write to the database.

+ Inheritance diagram for Mutex:

Public Member Methods

 Mutex ()
 Default constructor. More...
 
 Mutex (PCChar8 name)
 Default constructor. More...
 
 ~Mutex ()
 Destructor. More...
 
void Lock ()
 Locks the mutex. More...
 
bool Lock (TimeSpan timeOut)
 Locks the mutex. More...
 
void Unlock ()
 Unlocks the mutex. More...
 

Constructor & Destructor Documentation

Mutex ( )

Default constructor.

Warning
Non-Deterministic. Determinism when using ConceptRT library can be ensure by using Context Time Critical mechanisms.
Mutex ( PCChar8  name)

Default constructor.

Parameters
nameThe name.
Warning
Non-Deterministic. Determinism when using ConceptRT library can be ensure by using Context Time Critical mechanisms.
~Mutex ( )

Destructor.

Warning
Non-Deterministic. Determinism when using ConceptRT library can be ensure by using Context Time Critical mechanisms.

Methods Documentation

void Lock ( )
virtual

Locks the mutex.

Implements ILockable.

bool Lock ( TimeSpan  timeOut)

Locks the mutex.

Parameters
timeOutThe time out.
Returns
true if lock success, false if timeout occurs.
void Unlock ( )
virtual

Unlocks the mutex.

Implements ILockable.