fltk::Guard Class Reference

List of all members.

Public Member Functions

 Guard (Mutex &m)
 Guard (Mutex *m)

Detailed Description

C++ convienence object for locking a Mutex. Creating a local one of these will lock() the mutex and it means unlock() will be called no matter how a function exits, because the destructor ~Guard() does an unlock().

   static fltk::Mutex mutex;
   function() {
     fltk::Guard guard(mutex);
     do_stuff;
     throw_exceptions;
     if (test()) return;
     etc;
   }