| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
| 10 |
| 11 |
| 12 |
| 13 |
| 14 |
| 15 |
| 16 |
| 17 |
| 18 |
| 19 |
| 20 |
|
| #include <pthread.h> |
|
| typedef struct Future_WatcherSpec Future_WatcherSpec; |
|
| typedef enum Future_State { |
| Future_State_Waiting, |
| Future_State_Done |
| } Future_State; |
|
| struct Future { |
| Future_vfptrs_t *vfptrs; |
| Future_State state; |
| void *value; |
| bool canceled; |
| pthread_mutex_t mutex; |
| Future_WatcherSpec *watchers; |
| int nwatchers; |
| int maxwatchers; |
| }; |
|
|