Merge branch 'ct' of git.pipapo.org:cinelerra-ct into ct
[cinelerra_cv/ct.git] / guicast / mutex.h
blob7c08452cb273ea75013d55251c867a22b68f42eb
1 #ifndef MUTEX_H
2 #define MUTEX_H
4 #include <pthread.h>
5 #include <stdio.h>
7 class Mutex
9 public:
10 Mutex(char *title = 0, int recursive = 0);
11 ~Mutex();
13 int lock(char *location = 0);
14 int unlock();
15 // Calls pthread_mutex_trylock, whose effect depends on library version.
16 int trylock();
17 int reset();
18 // Returns 1 if count is > 0
19 int is_locked();
21 // Number of times the thread currently holding the mutex has locked it.
22 // For recursive locking.
23 int count;
24 // ID of the thread currently holding the mutex. For recursive locking.
25 pthread_t thread_id;
26 int thread_id_valid;
27 int recursive;
28 // Lock the variables for recursive locking.
29 pthread_mutex_t recursive_lock;
30 pthread_mutex_t mutex;
31 char *title;
35 #endif
37 // Local Variables:
38 // mode: C++
39 // c-file-style: "linux"
40 // End: