summaryrefslogtreecommitdiff
path: root/devel/glib2/patches
diff options
context:
space:
mode:
authorjklos <jklos@pkgsrc.org>2014-09-14 21:36:19 +0000
committerjklos <jklos@pkgsrc.org>2014-09-14 21:36:19 +0000
commit46fd4c5e436fcb539b26ad4ecd00d5965653433e (patch)
tree52fbb172c86e41cf174c38cca0c6ba3f18dd3c99 /devel/glib2/patches
parentb3090514c35bf3c7ecb65cd5d3e14e990dcdde03 (diff)
downloadpkgsrc-46fd4c5e436fcb539b26ad4ecd00d5965653433e.tar.gz
Fixes glib2 on netbsd-5. From OBATA Akio. Tested on macppc and amd64.
Diffstat (limited to 'devel/glib2/patches')
-rw-r--r--devel/glib2/patches/patch-glib_gthread-posix.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/devel/glib2/patches/patch-glib_gthread-posix.c b/devel/glib2/patches/patch-glib_gthread-posix.c
new file mode 100644
index 00000000000..dca831bd26c
--- /dev/null
+++ b/devel/glib2/patches/patch-glib_gthread-posix.c
@@ -0,0 +1,34 @@
+$NetBSD: patch-glib_gthread-posix.c,v 1.1 2014/09/14 21:36:19 jklos Exp $
+
+--- glib/gthread-posix.c.orig 2014-02-22 15:29:07.000000000 +0000
++++ glib/gthread-posix.c
+@@ -644,6 +644,7 @@ g_cond_impl_new (void)
+ #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");
++#elif defined (CLOCK_MONOTONIC)
+ #else
+ #error Cannot support GCond on your platform.
+ #endif
+@@ -892,6 +893,21 @@ g_cond_wait_until (GCond *cond,
+ if ((status = pthread_cond_timedwait (g_cond_get_impl (cond), g_mutex_get_impl (mutex), &ts)) == 0)
+ return TRUE;
+ }
++#elif defined (CLOCK_MONOTONIC)
++ {
++ gint64 monotonic_now = g_get_monotonic_time ();
++ gint64 real_end_time;
++
++ if (end_time <= monotonic_now)
++ return FALSE;
++
++ real_end_time = g_get_real_time () + (end_time - monotonic_now);
++
++ ts.tv_sec = real_end_time / 1000000;
++ ts.tv_nsec = (real_end_time % 1000000) * 1000;
++ if ((status = pthread_cond_timedwait (g_cond_get_impl (cond), g_mutex_get_impl (mutex), &ts)) == 0)
++ return TRUE;
++ }
+ #else
+ #error Cannot support GCond on your platform.
+ #endif