1
#if defined(XMLRPC_THREADS)
3
#include "XmlRpcMutex.h"
6
# define WIN32_LEAN_AND_MEAN
12
using namespace XmlRpc;
16
XmlRpcMutex::~XmlRpcMutex()
21
::CloseHandle((HANDLE)_pMutex);
23
::pthread_mutex_destroy((pthread_mutex_t*)_pMutex);
30
//! Wait for the mutex to be available and then acquire the lock.
31
void XmlRpcMutex::acquire()
35
_pMutex = ::CreateMutex(0, TRUE, 0);
37
::WaitForSingleObject(_pMutex, INFINITE);
41
_pMutex = new pthread_mutex_t;
42
::pthread_mutex_init((pthread_mutex_t*)_pMutex, 0);
44
::pthread_mutex_lock((pthread_mutex_t*)_pMutex);
48
//! Release the mutex.
49
void XmlRpcMutex::release()
53
::ReleaseMutex(_pMutex);
55
::pthread_mutex_unlock((pthread_mutex_t*)_pMutex);
59
#endif // XMLRPC_THREADS