ruby-changes:19422
From: nobu <ko1@a...>
Date: Sat, 7 May 2011 18:28:49 +0900 (JST)
Subject: [ruby-changes:19422] Ruby:r31462 (trunk): * thread_pthread.c (USE_MONOTONIC_COND): check the availability
nobu 2011-05-07 18:28:43 +0900 (Sat, 07 May 2011) New Revision: 31462 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=31462 Log: * thread_pthread.c (USE_MONOTONIC_COND): check the availability more strictly. * thread_pthread.h (rb_thread_cond_t): ditto. Modified files: trunk/ChangeLog trunk/thread_pthread.c trunk/thread_pthread.h Index: ChangeLog =================================================================== --- ChangeLog (revision 31461) +++ ChangeLog (revision 31462) @@ -1,3 +1,10 @@ +Sat May 7 18:28:37 2011 Nobuyoshi Nakada <nobu@r...> + + * thread_pthread.c (USE_MONOTONIC_COND): check the availability + more strictly. + + * thread_pthread.h (rb_thread_cond_t): ditto. + Sat May 7 15:18:06 2011 KOSAKI Motohiro <kosaki.motohiro@g...> fix incorrect native_cond_signal call when deadlock was detected. Index: thread_pthread.c =================================================================== --- thread_pthread.c (revision 31461) +++ thread_pthread.c (revision 31462) @@ -30,8 +30,11 @@ #define RB_CONDATTR_CLOCK_MONOTONIC 1 -#if defined(HAVE_PTHREAD_CONDATTR_SETCLOCK) && defined(CLOCK_MONOTONIC) && defined(HAVE_CLOCK_GETTIME) +#if defined(HAVE_PTHREAD_CONDATTR_SETCLOCK) && defined(HAVE_CLOCKID_T) && \ + defined(CLOCK_REALTIME) && defined(CLOCK_MONOTONIC) && defined(HAVE_CLOCK_GETTIME) #define USE_MONOTONIC_COND 1 +#else +#define USE_MONOTONIC_COND 0 #endif #define GVL_SIMPLE_LOCK 0 @@ -230,10 +233,10 @@ int r; pthread_condattr_t attr; - cond->clockid = CLOCK_REALTIME; pthread_condattr_init(&attr); #if USE_MONOTONIC_COND + cond->clockid = CLOCK_REALTIME; if (flags & RB_CONDATTR_CLOCK_MONOTONIC) { r = pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); if (r == 0) { @@ -323,10 +326,10 @@ rb_sys_fail("clock_gettime()"); goto out; } -#endif if (cond->clockid != CLOCK_REALTIME) rb_bug("unsupported clockid %d", cond->clockid); +#endif ret = gettimeofday(&tv, 0); if (ret != 0) Index: thread_pthread.h =================================================================== --- thread_pthread.h (revision 31461) +++ thread_pthread.h (revision 31462) @@ -20,7 +20,9 @@ typedef struct rb_thread_cond_struct { pthread_cond_t cond; +#ifdef HAVE_CLOCKID_T clockid_t clockid; +#endif } rb_thread_cond_t; typedef struct native_thread_data_struct { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/