diff options
Diffstat (limited to 'src/fscomch.h')
| -rw-r--r-- | src/fscomch.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/fscomch.h b/src/fscomch.h new file mode 100644 index 0000000..b7900e3 --- /dev/null +++ b/src/fscomch.h @@ -0,0 +1,24 @@ +#include <stdio.h> +#ifndef FSCOMCH +#define FSCOMCH + +/* 1/2 second */ +static const unsigned long int awaitMatchNs = 500000000L; +/* 1/4 second */ +static const unsigned long int awaitMoveNs = 250000000L; + +typedef struct Match { + char* uuid; + FILE* streamIn; + FILE* streamOut; +} match_t; +match_t init_match(char* uuid, FILE* streamIn, FILE* streamOut); +void destroy_match(match_t match); +/* returns null if the matchfile is already extant */ +FILE* try_lock_match(); +/* creates a new match, waits for it to be joined by another player */ +match_t await_match(FILE* matchFile, char* cancelToken); +/* joins an existing match */ +match_t join_match(); +char* make_uuid(); +#endif |
