Annotation of parser3/src/targets/apache13/modules/extra/pa_threads.C, revision 1.2

1.1       parser      1: /** @file
                      2:        Parser: Mutex realization class.
                      3: 
                      4:        Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
                      5: 
                      6:        Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
                      7: 
1.2     ! parser      8:        $Id: pa_threads.C,v 1.1 2001/05/17 10:49:56 parser Exp $
1.1       parser      9: */
                     10: 
                     11: #include "pa_threads.h"
                     12: 
1.2     ! parser     13: Mutex global_mutex;
1.1       parser     14: 
                     15: #include "ap_config.h"
1.2     ! parser     16: #include "multithread.h"
        !            17: // defined in ap_config
        !            18: #ifdef MULTITHREAD
1.1       parser     19: 
1.2     ! parser     20: Mutex::Mutex() : 
        !            21:        handle(reinterpret_cast<uint>(ap_create_mutex(0))) {
        !            22:                if(!handle) {
        !            23:                        __asm {
        !            24:                                int 3;
        !            25:                        };
        !            26:                }
        !            27:                        
1.1       parser     28: }
                     29: 
                     30: Mutex::~Mutex() {
                     31:        ap_destroy_mutex(reinterpret_cast<mutex *>(handle));
                     32: }
                     33: 
                     34: void Mutex::acquire() {
1.2     ! parser     35:        if(!handle)
        !            36:                        __asm {
        !            37:                                int 3;
        !            38:                        };
1.1       parser     39:        ap_acquire_mutex(reinterpret_cast<mutex *>(handle));
                     40: }
                     41: 
                     42: void Mutex::release() {
                     43:        ap_release_mutex(reinterpret_cast<mutex *>(handle));
                     44: }
1.2     ! parser     45: 
        !            46: #else
        !            47: 
        !            48: Mutex::Mutex() {}
        !            49: Mutex::~Mutex() {}
        !            50: void Mutex::acquire() {}
        !            51: void Mutex::release() {}
1.1       parser     52: 
                     53: #endif

E-mail: