Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


Mutex.h
1#ifndef STK_MUTEX_H
2#define STK_MUTEX_H
3
4#include "Stk.h"
5
6#if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__))
7
8 #include <pthread.h>
9 typedef pthread_mutex_t MUTEX;
10 typedef pthread_cond_t CONDITION;
11
12#elif defined(__OS_WINDOWS__)
13
14 #include <windows.h>
15 #include <process.h>
16 typedef CRITICAL_SECTION MUTEX;
17 typedef HANDLE CONDITION;
18
19#endif
20
21namespace stk {
22
23/***************************************************/
34/***************************************************/
35
36class Mutex : public Stk
37{
38 public:
41
44
46 void lock(void);
47
49 void unlock(void);
50
52
56 void wait(void);
57
59
63 void signal(void);
64
65 protected:
66
67 MUTEX mutex_;
68 CONDITION condition_;
69
70};
71
72} // stk namespace
73
74#endif
STK mutex class.
Definition Mutex.h:37
~Mutex()
Class destructor.
Mutex()
Default constructor.
void signal(void)
Signal the condition variable.
void unlock(void)
Unlock the mutex.
void lock(void)
Lock the mutex.
void wait(void)
Wait indefinitely on the mutex condition variable.
STK base class.
Definition Stk.h:136
The STK namespace.
Definition ADSR.h:6

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