pkgsrc-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: glib2 no longer works on NetBSD 5
On Sun, 14 Sep 2014 01:43:45 +0900, Joerg Sonnenberger
<joerg%britannica.bec.de@localhost> wrote:
On Sat, Sep 13, 2014 at 04:26:33PM +0000, John Klos wrote:
Latest pkgsrc, netbsd-5 on multiple platforms:
Trying something like the attached patch.
Need to specify with real time?
$NetBSD$
--- 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
--
OBATA Akio / obata%lins.jp@localhost
Home |
Main Index |
Thread Index |
Old Index