The Synthesis ToolKit in C++ (STK)

Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial

# Mutex.h

    00001 #ifndef STK_MUTEX_H
    00002 #define STK_MUTEX_H
    00003
    00004 #include "Stk.h"
    00005
    00006 #if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__))
    00007
    00008   #include <pthread.h>
    00009   typedef pthread_mutex_t MUTEX;
    00010   typedef pthread_cond_t CONDITION;
    00011
    00012 #elif defined(__OS_WINDOWS__)
    00013
    00014   #include <windows.h>
    00015   #include <process.h>
    00016   typedef CRITICAL_SECTION MUTEX;
    00017   typedef HANDLE CONDITION;
    00018
    00019 #endif
    00020
    00021 namespace stk {
    00022
    00023 /***************************************************/
    00034 /***************************************************/
    00035
    00036 class Mutex : public Stk
    00037 {
    00038  public:
    00040   Mutex();
    00041
    00043   ~Mutex();
    00044
    00046   void lock(void);
    00047
    00049   void unlock(void);
    00050
    00052
    00056   void wait(void);
    00057
    00059
    00063   void signal(void);
    00064
    00065  protected:
    00066
    00067   MUTEX mutex_;
    00068   CONDITION condition_;
    00069
    00070 };
    00071
    00072 } // stk namespace
    00073
    00074 #endif

The Synthesis ToolKit in C++ (STK)
©1995-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.