Public Member Functions

mlock Class Reference
[Threadsafe Collection API]

class that automatically locks and unlocks pthread mutexes To use mlocks in code:

More...

#include <smart_mutex.h>

List of all members.

Public Member Functions

 mlock (IN smart_mutex &sm)
 constructor that accepts smart_mutex
 ~mlock (void)
 destructor automatically unlocks

Detailed Description

class that automatically locks and unlocks pthread mutexes To use mlocks in code:

Example:

        void threadsafeFunction(void)
        {
                smart_mutex my_mutex;
   
                mlock lock(my_mutex);   // blocks until mutex is acquired
   
                // some stuff that needs to be protected happens here
                ...
   
        }  <--- mutex is unlocked here as mlock destructor is called

Definition at line 110 of file smart_mutex.h.


Constructor & Destructor Documentation

mlock::mlock ( IN smart_mutex sm  )  [inline]

constructor that accepts smart_mutex

Definition at line 113 of file smart_mutex.h.


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