Annotation of parser3/src/main/pa_threads.C, revision 1.1
1.1 ! paf 1: /*
! 2: $Id: pa_pool.C,v 1.3 2001/01/26 18:34:02 paf Exp $
! 3: */
! 4:
! 5: #include "pa_threads.h"
! 6:
! 7: #ifdef MULTITHREAD
! 8:
! 9: // either apache module or win32 prog for now
! 10: #ifdef MOD_PARSER
! 11: # include "ap_config.h"
! 12: #else// WIN32
! 13: # include <winbase.h>
! 14: #endif
! 15:
! 16:
! 17: #ifdef MOD_PARSER
! 18:
! 19: Mutex::Mutex() {
! 20: handle=reinterpret_cast<mutex *>(ap_create_mutex(0));
! 21: }
! 22:
! 23: Mutex::~Mutex() {
! 24: ap_destroy_mutex(reinterpret_cast<mutex *>(handle));
! 25: }
! 26:
! 27: void Mutex::lock() {
! 28: ap_acquire_mutex(reinterpret_cast<mutex *>(handle));
! 29: }
! 30:
! 31: void Mutex::unlock() {
! 32: ap_release_mutex(reinterpret_cast<mutex *>(handle));
! 33: }
! 34:
! 35: #else// WIN32
! 36:
! 37: Mutex::Mutex() {
! 38: handle=CreateMutex(NULL, FALSE, 0);
! 39: }
! 40:
! 41: Mutex::~Mutex() {
! 42: CloseHandle(handle);
! 43: }
! 44:
! 45: void Mutex::lock() {
! 46: WaitForSingleObject(handle, INFINITE);
! 47: }
! 48:
! 49: void Mutex::unlock() {
! 50: ReleaseMutex(handle);
! 51: }
! 52:
! 53: #endif
! 54:
! 55: #endif
E-mail: