summaryrefslogtreecommitdiff
path: root/src/fscomch.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/fscomch.h')
-rw-r--r--src/fscomch.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/fscomch.h b/src/fscomch.h
index bc92467..6aa7fb7 100644
--- a/src/fscomch.h
+++ b/src/fscomch.h
@@ -14,15 +14,22 @@ typedef struct Match {
} match_t;
match_t init_match(char* uuid, FILE* streamIn, FILE* streamOut);
void destroy_match(match_t match);
+typedef struct CancellationToken {
+ int timeout;
+ volatile char* value;
+} cancelToken_t;
+cancelToken_t init_cancel_token_timeout(int seconds);
+cancelToken_t init_cancel_token_never();
/* 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);
+match_t await_match(FILE* matchFile, cancelToken_t cancelToken);
/* joins an existing match */
match_t join_match();
void send_message(char* content, match_t match);
/* blocks */
-char* read_message(match_t match, char* cancelToken);
+char* read_message(match_t match, cancelToken_t cancelToken);
char* make_uuid();
+void* cancel_in_secs(void* token);
#endif