tests: fix sched test under non glibc platforms

As mentioned in tracker#170,
glibc's sched_setscheduler is rather broken and pthread functionality
should be used instead. musl only exposes a stub for sched_setscheduler
for this reason. tracker already correctly sets the scheduler via pthread,
but it didn't adjust the tests and as such the tests still failed on musl.
parent d43e4a3e
......@@ -35,7 +35,13 @@ static gboolean
scheduler_is (gint scheduler)
{
#ifdef __linux__
return (sched_getscheduler (0) == scheduler);
int policy;
struct sched_param param;
if (pthread_getschedparam (pthread_self (), &policy, &param) != 0) {
g_assert_not_reached ();
}
return (policy == scheduler);
#else
return TRUE;
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment