mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-24 13:06:14 +01:00
Merge branch '2191-scheduler-warnings' into 'master'
gthread: Only print scheduler setting warnings once Closes #2191 See merge request GNOME/glib!1637
This commit is contained in:
commit
054ef4ddf7
@ -1235,6 +1235,7 @@ static void *
|
|||||||
linux_pthread_proxy (void *data)
|
linux_pthread_proxy (void *data)
|
||||||
{
|
{
|
||||||
GThreadPosix *thread = data;
|
GThreadPosix *thread = data;
|
||||||
|
static gboolean printed_scheduler_warning = FALSE; /* (atomic) */
|
||||||
|
|
||||||
/* Set scheduler settings first if requested */
|
/* Set scheduler settings first if requested */
|
||||||
if (thread->scheduler_settings)
|
if (thread->scheduler_settings)
|
||||||
@ -1247,8 +1248,11 @@ linux_pthread_proxy (void *data)
|
|||||||
tid = (pid_t) syscall (SYS_gettid);
|
tid = (pid_t) syscall (SYS_gettid);
|
||||||
res = syscall (SYS_sched_setattr, tid, thread->scheduler_settings->attr, flags);
|
res = syscall (SYS_sched_setattr, tid, thread->scheduler_settings->attr, flags);
|
||||||
errsv = errno;
|
errsv = errno;
|
||||||
if (res == -1)
|
if (res == -1 && g_atomic_int_compare_and_exchange (&printed_scheduler_warning, FALSE, TRUE))
|
||||||
g_critical ("Failed to set scheduler settings: %s", g_strerror (errsv));
|
g_critical ("Failed to set scheduler settings: %s", g_strerror (errsv));
|
||||||
|
else if (res == -1)
|
||||||
|
g_debug ("Failed to set scheduler settings: %s", g_strerror (errsv));
|
||||||
|
printed_scheduler_warning = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return thread->proxy (data);
|
return thread->proxy (data);
|
||||||
|
Loading…
Reference in New Issue
Block a user