Annotation of parser3/src/include/pa_threads.h, revision 1.2

1.1       paf         1: /*
1.2     ! paf         2:   $Id: pa_threads.h,v 1.1 2001/01/29 11:17:49 paf Exp $
1.1       paf         3: */
                      4: 
                      5: #ifndef PA_THREADS_H
                      6: #define PA_THREADS_H
                      7: 
                      8: #ifdef HAVE_CONFIG_H
                      9: #      include "pa_config.h"
                     10: #endif
                     11: 
                     12: #include "pa_types.h"
                     13: 
                     14: 
                     15: #ifdef MULTITHREAD
                     16: 
                     17: class Mutex {
                     18:        uint handle;
                     19: public:
                     20:        Mutex();
                     21:        ~Mutex();
1.2     ! paf        22:        void acquire();
        !            23:        void release();
1.1       paf        24: };
                     25: 
1.2     ! paf        26: extern Mutex global_mutex;
1.1       paf        27: 
1.2     ! paf        28: class AutoSYNCHRONIZED {
        !            29: public:
        !            30:        AutoSYNCHRONIZED() { global_mutex.acquire(); }
        !            31:        ~AutoSYNCHRONIZED() { global_mutex.release(); }
        !            32: }
        !            33: 
        !            34: #define SYNCHRONIZED AutoSYNCHRONIZED autoSYNCHRONIZED()
        !            35: 
        !            36: 
        !            37: #else // not MULTITHREAD-ed
        !            38: 
        !            39: #define SYNCHRONIZED /* do nothing */
1.1       paf        40: 
                     41: #endif
1.2     ! paf        42: 
1.1       paf        43: 
                     44: #endif

E-mail: