42 #include "SDL/SDL_thread.h"
59 m_lock = (
void*) SDL_CreateMutex();
61 pthread_mutexattr_t attr;
63 pthread_mutex_init( (pthread_mutex_t*)&m_lock, &attr);
65 pthread_mutexattr_init(&attr);
66 pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST);
67 pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_RECURSIVE );
68 if ( pthread_mutex_init((pthread_mutex_t*)&m_lock, &attr) != 0 ) {
69 cout <<
"couldn create mutex and init with PTHREAD_MUTEX_RECURSIVE" << endl;
75 m_lock = (
void*)CreateMutex( NULL, FALSE, L
"lockMutex" );
77 m_lock = (
void*)CreateMutex( NULL, FALSE,
"lockMutex" );
87 SDL_DestroyMutex((SDL_mutex*)m_lock);
90 pthread_mutex_destroy( (pthread_mutex_t*)&m_lock );
109 return(SDL_mutexP( (SDL_mutex*)m_lock )!=-1);
111 if (pthread_mutex_lock( (pthread_mutex_t*)&m_lock ) < 0 ) {
116 WaitForSingleObject( m_lock, INFINITE);
145 return(SDL_mutexV( (SDL_mutex*)m_lock )!=-1);
147 if (pthread_mutex_unlock( (pthread_mutex_t*)&m_lock )<0) {
152 return ReleaseMutex( m_lock );