r136: This commit was manufactured by cvs2svn to create tag 'hv_1_1_8'.
[cinelerra_cv/ct.git] / hvirtual / guicast / condition.h
blobc70512d40ce31dffd3143a69e0048570e7d6652a
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);
10 ~Condition();
12 // Reset to init_value whether locked or not.
13 void reset();
14 // Block if value <= 0, then decrease value
15 void lock(char *location = 0);
16 // Increase value
17 void unlock();
18 // Block for requested duration if value <= 0.
19 // value is decreased whether or not the condition is unlocked in time
20 int timed_lock(int microseconds, char *location = 0);
21 int get_value();
23 pthread_cond_t cond;
24 pthread_mutex_t mutex;
25 int value;
26 int init_value;
27 char *title;
31 #endif