Commit 3847bc2e authored by Philip Withnall's avatar Philip Withnall

Merge branch 'fallback-setattr-failure' into 'master'

GThread - Check if sched_setattr is allowed by the system policies before depending on it

See merge request GNOME/glib!1356
parents 551576fb 9308ef9a
...@@ -1211,6 +1211,19 @@ g_system_thread_get_scheduler_settings (GThreadSchedulerSettings *scheduler_sett ...@@ -1211,6 +1211,19 @@ g_system_thread_get_scheduler_settings (GThreadSchedulerSettings *scheduler_sett
} }
while (res == -1); while (res == -1);
/* Try setting them on the current thread to see if any system policies are
* in place that would disallow doing so */
res = syscall (SYS_sched_setattr, tid, scheduler_settings->attr, flags);
if (res == -1)
int errsv = errno;
g_debug ("Failed to set thread scheduler attributes: %s", g_strerror (errsv));
g_free (scheduler_settings->attr);
return FALSE;
return TRUE; return TRUE;
#else #else
return FALSE; return FALSE;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment