00001 /* 00002 $Id: mutex_beos.cpp,v 1.1 2000/07/18 17:04:27 sphair Exp $ 00003 00004 ------------------------------------------------------------------------ 00005 ClanLib, the platform independent game SDK. 00006 00007 This library is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE 00008 version 2. See COPYING for details. 00009 00010 For a total list of contributers see CREDITS. 00011 00012 ------------------------------------------------------------------------ 00013 */ 00014 00015 #include "Core/precomp.h" 00016 00017 #include "mutex_beos.h" 00018 00019 CL_Mutex *CL_Mutex::create() 00020 { 00021 return new CL_Mutex_BeOS; 00022 } 00023 00024 CL_Mutex_BeOS::CL_Mutex_BeOS() 00025 { 00026 sem = create_sem(1, "ClanLibMutex"); 00027 owner = -1; 00028 } 00029 00030 CL_Mutex_BeOS::~CL_Mutex_BeOS() 00031 { 00032 delete_sem(sem); 00033 } 00034 00035 void CL_Mutex_BeOS::enter() 00036 { 00037 status_t err = acquire_sem(sem); 00038 if(!err) 00039 owner = find_thread(NULL); 00040 } 00041 00042 void CL_Mutex_BeOS::leave() 00043 { 00044 if(owner != find_thread(NULL)) 00045 return; 00046 00047 owner = -1; 00048 release_sem(sem); 00049 } 00050 00051 void CL_Mutex_BeOS::wait() 00052 { 00053 // pthread_cond_wait(&cond,&mutex); 00054 } 00055 00056 void CL_Mutex_BeOS::notify() 00057 { 00058 // pthread_cond_signal(&cond); 00059 } 00060 00061 void CL_Mutex_BeOS::notify_all() 00062 { 00063 // pthread_cond_broadcast(&cond); 00064 }
1.2.6 written by Dimitri van Heesch,
© 1997-2001