mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1e769ce6ed
commit
291afc96bd
1 changed files with 7 additions and 1 deletions
|
@ -1580,12 +1580,18 @@ static void
|
|||
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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue