Revert 32b80d832b80d8... new cache manager first part, incomplete
[cinelerra_cv/ct.git] / guicast / condition.h
blobf35ce997144849ba9a2a4f60416b422041fab82f
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
36 // Local Variables:
37 // mode: C++
38 // c-file-style: "linux"
39 // End: