From f0c70a148bffeb4faa362a3e696857461aae0419 Mon Sep 17 00:00:00 2001 From: Ryo Nakamura Date: Wed, 15 Mar 2023 23:18:33 +0900 Subject: macOS does not support sem_init. use sem_open instead --- src/platform.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/platform.c') diff --git a/src/platform.c b/src/platform.c index 078fc93..7d6a94d 100644 --- a/src/platform.c +++ b/src/platform.c @@ -1,4 +1,5 @@ #ifdef __APPLE__ +#include #include #include #elif linux @@ -32,6 +33,11 @@ int set_thread_affinity(pthread_t tid, int core) return 0; } +int get_random(int max) +{ + return arc4random() % max; +} + #endif #ifdef linux @@ -56,5 +62,10 @@ int set_thread_affinity(pthread_t tid, int core) core, strerrno()); return ret; } + +int get_random(int max) +{ + return random() % max; +} #endif -- cgit v1.2.3