Annotation of parser3/src/targets/apache13/pa_threads.C, revision 1.6
1.1 parser 1: /** @file
2: Parser: Mutex realization class.
3:
1.6 ! paf 4: Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com)
1.3 paf 5: Author: Alexander Petrosyan <paf@design.ru> (http://paf.design.ru)
1.1 parser 6:
1.6 ! paf 7: $Id: pa_threads.C,v 1.5 2002/01/21 13:04:03 paf Exp $
1.1 parser 8: */
9:
10: #include "pa_threads.h"
11:
12: Mutex global_mutex;
13:
14: #include "ap_config.h"
15: // defined in ap_config
16: #ifdef MULTITHREAD
17: #include "multithread.h"
18:
1.2 paf 19: const bool parser_multithreaded=true;
20:
1.4 paf 21: pa_thread_t pa_get_thread_id() {
22: return static_cast<pa_thread_t>(
23: #ifdef WIN32
24: GetThreadID()
25: #else
26: # ifdef to-do-PTHREADS
27: pthread_self()
28: # else
29: # ifdef to-do-SOLARIS_THREADS
30: thr_self()
31: # else
32: # error there must be some get_thread_id function
33: # endif
34: # endif
35: #endif
36: );
37: }
38:
1.1 parser 39: Mutex::Mutex() :
40: handle(reinterpret_cast<uint>(ap_create_mutex(0))) {
41: }
42:
43: Mutex::~Mutex() {
44: ap_destroy_mutex(reinterpret_cast<mutex *>(handle));
45: }
46:
47: void Mutex::acquire() {
48: ap_acquire_mutex(reinterpret_cast<mutex *>(handle));
49: }
50:
51: void Mutex::release() {
52: ap_release_mutex(reinterpret_cast<mutex *>(handle));
53: }
54:
55: #else
1.2 paf 56:
57: const bool parser_multithreaded=false;
1.4 paf 58:
1.5 paf 59: pa_thread_t pa_get_thread_id() { return 1; }
1.1 parser 60:
61: Mutex::Mutex() {}
62: Mutex::~Mutex() {}
63: void Mutex::acquire() {}
64: void Mutex::release() {}
65:
66: #endif
E-mail: