r1009: Move the dependencies to newer package names
[cinelerra_cv/mob.git] / guicast / condition.h
blob6b692f2163ba5beb9ed3b32200f56a5e8b8b91ff
1 #ifndef CONDITION_H
2 #define CONDITION_H
4 #include <pthread.h>
6 class Condition
8 public:
9 Condition(int init_value = 0, char *title = 0, int is_binary = 0);
10 ~Condition();
13 // Reset to init_value whether locked or not.
14 void reset();
15 // Block if value <= 0, then decrease value
16 void lock(char *location = 0);
17 // Increase value
18 void unlock();
19 // Block for requested duration if value <= 0.
20 // value is decreased whether or not the condition is unlocked in time
21 // Returns 1 if timeout or 0 if success.
22 int timed_lock(int microseconds, char *location = 0);
23 int get_value();
25 pthread_cond_t cond;
26 pthread_mutex_t mutex;
27 int value;
28 int init_value;
29 int is_binary;
30 char *title;
34 #endif