Annotation of parser3/src/targets/apache13/pa_threads.C, revision 1.10

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.7       paf         5:        Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.9       paf         6: */
1.1       parser      7: 
1.10    ! paf         8: static const char* IDENT_THREADS_C="$Date: pa_threads.C,v 1.9 2002/08/01 11:26:52 paf Exp $";
1.1       parser      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
1.8       paf        24:                GetCurrentThreadId()
1.4       paf        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: