-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature [posix]: Add bindings to scheduler policy (#3831)
- Loading branch information
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#if defined(__unix__) || defined(__unix) || defined(unix) || \ | ||
(defined(__APPLE__) && defined(__MACH__)) | ||
|
||
#include <sched.h> | ||
|
||
int scalanative_sched_other() { return SCHED_OTHER; } | ||
|
||
int scalanative_sched_fifo() { return SCHED_FIFO; } | ||
|
||
int scalanative_sched_rr() { return SCHED_RR; } | ||
|
||
int scalanative_sched_sporadic() { | ||
#ifdef SCHED_SPORADIC | ||
return SCHED_SPORADIC; | ||
#else | ||
return SCHED_OTHER; | ||
#endif | ||
} | ||
|
||
int scalanative_sched_batch() { | ||
#ifdef SCHED_BATCH | ||
return SCHED_BATCH; | ||
#else | ||
return SCHED_OTHER; | ||
#endif | ||
} | ||
|
||
int scalanative_sched_idle() { | ||
#ifdef SCHED_IDLE | ||
return SCHED_IDLE; | ||
#else | ||
return SCHED_OTHER; | ||
#endif | ||
} | ||
|
||
int scalanative_sched_deadline() { | ||
#ifdef SCHED_DEADLINE | ||
return SCHED_DEADLINE; | ||
#else | ||
return SCHED_OTHER; | ||
#endif | ||
} | ||
|
||
#endif // Unix or Mac OS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters