Credit Andrew R for finding the direct copy mods for exr and ppm sequences
[goodguy/cinelerra.git] / cinelerra-5.1 / libzmpeg3 / mutex.h
1 #ifndef _included_mutex
2 #define _included_mutex
3
4 #include <pthread.h>
5 class Mutex
6 {
7 private:pthread_mutex_t m;
8 public:Mutex ()
9   {
10     pthread_mutex_init (&m, 0);
11   }
12    ~Mutex ()
13   {
14     pthread_mutex_destroy (&m);
15   }
16   operator pthread_mutex_t & ()
17   {
18     return m;
19   }
20 };
21
22 class CriticalSection
23 {
24 private:pthread_mutex_t * m;
25 public:CriticalSection (pthread_mutex_t & _m)
26   {
27     m = &_m;
28     pthread_mutex_lock (m);
29   }
30    ~CriticalSection ()
31   {
32     pthread_mutex_unlock (m);
33   }
34 };
35
36
37 #endif /*  */