r877: Fix files that were missing from a make dist tarball.
[cinelerra_cv.git] / guicast / mutex.h
blobc0f58300f16855774d53876cd363b46f90d17f12
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