summaryrefslogtreecommitdiff
path: root/glib
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2014-02-21 16:40:16 -0500
committerRyan Lortie <desrt@desrt.ca>2014-02-21 16:42:21 -0500
commit5103c5d643f7e7de7983619204a25c3c774478e8 (patch)
treea47fb65a95a20e05ec1d3def34f334794eb4f3c9 /glib
parent03a43c290e470c67015d01237c5d81ea81a7b129 (diff)
GCond: check result of pthread_condattr_setclock()
Make sure this call succeeds, aborting if it doesn't This will prevent people from having to waste time chasing down the problems that would otherwise be caused by this silent failure.
Diffstat (limited to 'glib')
-rw-r--r--glib/gthread-posix.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/glib/gthread-posix.c b/glib/gthread-posix.c
index 4a01f4dad..c98c2d807 100644
--- a/glib/gthread-posix.c
+++ b/glib/gthread-posix.c
@@ -639,8 +639,13 @@ g_cond_impl_new (void)
gint status;
pthread_condattr_init (&attr);
-#if defined (HAVE_PTHREAD_CONDATTR_SETCLOCK) && defined (CLOCK_MONOTONIC)
- pthread_condattr_setclock (&attr, CLOCK_MONOTONIC);
+
+#ifdef HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP
+#elif defined (HAVE_PTHREAD_CONDATTR_SETCLOCK) && defined (CLOCK_MONOTONIC)
+ if G_UNLIKELY ((status = pthread_condattr_setclock (&attr, CLOCK_MONOTONIC)) != 0)
+ g_thread_abort (status, "pthread_condattr_setclock");
+#else
+#error Cannot support GCond on your platform.
#endif
cond = malloc (sizeof (pthread_cond_t));