ruby-changes:52148
From: normal <ko1@a...>
Date: Tue, 14 Aug 2018 11:24:42 +0900 (JST)
Subject: [ruby-changes:52148] normal:r64356 (trunk): thread_pthread.c: use CLOCK_REALTIME on SunOS (Solaris)
normal 2018-08-14 11:24:37 +0900 (Tue, 14 Aug 2018) New Revision: 64356 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64356 Log: thread_pthread.c: use CLOCK_REALTIME on SunOS (Solaris) timer_create does not seem to support CLOCK_MONOTONIC on Solaris, and CLOCK_HIRES seems like it could fail with insufficient permissions: https://docs.oracle.com/cd/E86824_01/html/E54766/timer-create-3c.html (Only tested on Linux and FreeBSD) [ruby-core:88360] [Misc #14937] Modified files: trunk/thread_pthread.c Index: thread_pthread.c =================================================================== --- thread_pthread.c (revision 64355) +++ thread_pthread.c (revision 64356) @@ -1580,12 +1580,18 @@ static void https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1580 rb_timer_create(rb_pid_t current) { #if UBF_TIMER == UBF_TIMER_POSIX +# if defined(__sun) +# define UBF_TIMER_CLOCK CLOCK_REALTIME +# else /* Tested Linux and FreeBSD: */ +# define UBF_TIMER_CLOCK CLOCK_MONOTONIC +# endif + struct sigevent sev; sev.sigev_notify = SIGEV_SIGNAL; sev.sigev_signo = SIGVTALRM; sev.sigev_value.sival_ptr = &timer_posix; - if (!timer_create(CLOCK_MONOTONIC, &sev, &timer_posix.timerid)) + if (!timer_create(UBF_TIMER_CLOCK, &sev, &timer_posix.timerid)) timer_posix.owner = current; else rb_warn("timer_create failed: %s, signals racy", strerror(errno)); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/