Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

/ray/src/lib/threads/mutex.cc

Go to the documentation of this file.
00001 /*
00002  * lib/threads/mutex.cc
00003  * 
00004  * Implementing mutual exclusion classes for thread synchronisation. 
00005  * 
00006  * Copyright (c) 2004 by Wolfgang Wieser ] wwieser (a) gmx <*> de [ 
00007  * 
00008  * This file may be distributed and/or modified under the terms of the 
00009  * GNU General Public License version 2 as published by the Free Software 
00010  * Foundation. (See COPYING.GPL for details.)
00011  * 
00012  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00013  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00014  * 
00015  */
00016 
00017 #include "mutex.h"
00018 
00019 
00020 FastMutex::FastMutex()
00021 {
00022 #if USE_PRIVATE__PTHREADS
00023     pthread_mutexattr_t attr;
00024     pthread_mutexattr_init(&attr);
00025     pthread_mutexattr_settype(&attr,PTHREAD_MUTEX_FAST_NP);
00026     pthread_mutex_init(&m,&attr);
00027     pthread_mutexattr_destroy(&attr);
00028 #else
00029     g_static_mutex_init(&m);
00030 #endif
00031 }
00032 
00033 
00034 RecursiveMutex::RecursiveMutex()
00035 {
00036 #if USE_PRIVATE__PTHREADS
00037     pthread_mutexattr_t attr;
00038     pthread_mutexattr_init(&attr);
00039     pthread_mutexattr_settype(&attr,PTHREAD_MUTEX_RECURSIVE_NP);
00040     pthread_mutex_init(&m,&attr);
00041     pthread_mutexattr_destroy(&attr);
00042 #else
00043     g_static_rec_mutex_init(&m);
00044 #endif
00045 }

Generated on Sat Feb 19 22:33:46 2005 for Ray by doxygen 1.3.5