lock_guard< T > Class Template Reference

Lock guard class. More...

#include <tinythread.h>

List of all members.

Public Member Functions

 lock_guard (mutex_type &aMutex)
 The constructor locks the mutex.
 ~lock_guard ()
 The destructor unlocks the mutex.

Detailed Description

template<class T>
class tthread::lock_guard< T >

Lock guard class.

The constructor locks the mutex, and the destructor unlocks the mutex, so the mutex will automatically be unlocked when the lock guard goes out of scope. Example usage:

 mutex m;
 int counter;

 void increment()
 {
   lock_guard<mutex> guard(m);
   ++ counter;
 }

The documentation for this class was generated from the following file:
Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by  doxygen 1.6.3