Thread/Util: make SCHED_RESET_ON_FORK optional
Use it if it exists, but don't insist if the C library is poor (e.g. Bionic/Android).
This commit is contained in:
parent
7f8dd0e939
commit
5eb468bce0
@ -78,7 +78,13 @@ SetThreadRealtime()
|
|||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
struct sched_param sched_param;
|
struct sched_param sched_param;
|
||||||
sched_param.sched_priority = 50;
|
sched_param.sched_priority = 50;
|
||||||
sched_setscheduler(0, SCHED_FIFO|SCHED_RESET_ON_FORK, &sched_param);
|
|
||||||
|
int policy = SCHED_FIFO;
|
||||||
|
#ifdef SCHED_RESET_ON_FORK
|
||||||
|
policy |= SCHED_RESET_ON_FORK;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
sched_setscheduler(0, policy, &sched_param);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user