Lock.h

Go to the documentation of this file.
00001 /* ex: set tabstop=4 expandtab: */
00002 /*                                                                                                                      */
00003 /*  (c) 2004-2006 Iowa State University                                         */
00004 /*      see the LICENSE file in the top level directory         */
00005 /*                                                                                                                      */
00011 
00012 #ifndef LOCK_H__
00013 #define LOCK_H__
00014 
00015 #include <pthread.h>
00016 
00017 class Lock {
00018         public:
00019                 //note that this explicit ctor implies that we cannot do a Lock foo = bar; which would otherwise be possible
00020                 explicit Lock(pthread_mutex_t* pm) : mutexPointer(pm) { pthread_mutex_lock(mutexPointer); }
00021                 ~Lock() { pthread_mutex_unlock(mutexPointer); }
00022         private:
00023                 Lock(const Lock& rhs);
00024                 Lock& operator=(const Lock& rhs);
00025                 pthread_mutex_t* mutexPointer;
00026 };
00027 
00028 #endif

Generated on Wed Mar 8 14:43:31 2006 for Fountain by  doxygen 1.4.6