00001 /* 00002 * This file is part of openMask © INRIA, CNRS, Universite de Rennes 1 1993-2002, thereinafter the Software 00003 * 00004 * The Software has been developped within the Siames Project. 00005 * INRIA, the University of Rennes 1 and CNRS jointly hold intellectual property rights 00006 * 00007 * The Software has been registered with the Agence pour la Protection des 00008 * Programmes (APP) under registration number IDDN.FR.001.510008.00.S.P.2001.000.41200 00009 * 00010 * This file may be distributed under the terms of the Q Public License 00011 * version 1.0 as defined by Trolltech AS of Norway and appearing in the file 00012 * LICENSE.QPL included in the packaging of this file. 00013 * 00014 * Licensees holding valid specific licenses issued by INRIA, CNRS or Université de Rennes 1 00015 * for the software may use this file in accordance with that specific license 00016 * 00017 */ 00018 #include "PsnMutexLock.h" 00019 00020 #include "PsController.h" 00021 00022 #ifdef _SGI 00023 #include <stdlib.h> 00024 #endif 00025 00026 #include <iostream> 00027 00028 PsnMutexLock::PsnMutexLock() { 00029 #ifdef NDEBUG 00030 int ret = 00031 #endif 00032 pthread_mutex_init(&mutex , NULL); 00033 #ifdef NDEBUG 00034 if (ret) { 00035 PsController::error("PsnMutexLock::PsnMutexLock() failed"); 00036 } 00037 #endif 00038 } 00039 00040 PsnMutexLock::~PsnMutexLock() { 00041 #ifdef NDEBUG 00042 int ret = 00043 #endif 00044 pthread_mutex_destroy( &mutex ); 00045 #ifdef NDEBUG 00046 if (ret) { 00047 PsController::error("PsnMutexLock::~PsnMutexLock() failed"); 00048 } 00049 #endif 00050 } 00051 00052 int PsnMutexLock::protect() { 00053 #ifdef _DEBUGLOCK 00054 cerr<<"PsnMutexLock::"<<this<<"::protect("; 00055 #endif 00056 #ifdef NDEBUG 00057 int ret = 00058 #endif 00059 pthread_mutex_lock( &mutex ); 00060 #ifdef NDEBUG 00061 if (ret) { 00062 PsController::error("PsnMutexLock::protect failed"); 00063 } 00064 #endif 00065 #ifdef _DEBUGLOCK 00066 cerr<<") effective for thread "<<pthread_self()<<endl; 00067 #endif 00068 return 0; 00069 } 00070 00071 int PsnMutexLock::unprotect() { 00072 #ifdef _DEBUGLOCK 00073 cerr<<"PsnMutexLock::"<<this<<"::unprotect("; 00074 #endif 00075 #ifdef NDEBUG 00076 int ret = 00077 #endif 00078 pthread_mutex_unlock( &mutex ); 00079 #ifdef NDEBUG 00080 if (ret) { 00081 PsController::error("PsnMutexLock::unprotect failed"); 00082 } 00083 #endif 00084 #ifdef _DEBUGLOCK 00085 cerr<<") effective for thread "<<pthread_self()<<endl; 00086 #endif 00087 return 0; 00088 }
| Documentation generated on Mon Nov 25 15:25:01 2002 |
Generated with doxygen 1.2.12 by Dimitri van Heesch , 1997-2001 |