mirror of
https://github.com/upa/mscp.git
synced 2026-02-15 09:44:43 +08:00
macOS does not support sem_init. use sem_open instead
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#ifdef __APPLE__
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user