Skip to content

Commit cecdab3

Browse files
author
matz
committed
* configure.in: check for nanosleep, -lrt if required.
[ruby-core:02059] * eval.c (thread_timer): use select(2) if nanosleep(2) is not available. * eval.c: check __stub_getcontext for glibc on some platforms. [ruby-list:38984] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 060f19e commit cecdab3

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

ChangeLog

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1-
Thu Dec 25 00:17:53 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
1+
Thu Dec 25 04:00:44 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
22

33
* stable version 1.8.1 released.
44

5+
Thu Dec 25 00:17:53 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
6+
7+
* configure.in: check for nanosleep, -lrt if required.
8+
[ruby-core:02059]
9+
10+
* eval.c (thread_timer): use select(2) if nanosleep(2) is not
11+
available.
12+
13+
* eval.c: check __stub_getcontext for glibc on some platforms.
14+
[ruby-list:38984]
15+
516
Wed Dec 24 23:48:04 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
617

718
* test/soap/test_basetype.rb, test/soap/marshal/test_marshal.rb

configure.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,10 @@ if test "$enable_pthread" = "yes"; then
721721
fi
722722
fi
723723
fi
724+
AC_CHECK_FUNC(nanosleep)
725+
if test "$ac_cv_func_nanosleep" = "no"; then
726+
AC_CHECK_LIB(rt, nanosleep, AC_DEFINE(HAVE_NANOSLEEP))
727+
fi
724728
fi
725729

726730
dnl default value for $KANJI

eval.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#endif
3030

3131
#include <stdio.h>
32-
#if defined(HAVE_UCONTEXT_H) && (defined(__ia64__) || defined(HAVE_NATIVETHREAD))
32+
#if defined(HAVE_UCONTEXT_H) && (defined(__ia64__) || defined(HAVE_NATIVETHREAD)) && !defined(__stub_getcontext)
3333
#include <ucontext.h>
3434
#define USE_CONTEXT
3535
#else
@@ -9552,12 +9552,19 @@ static void*
95529552
thread_timer(dummy)
95539553
void *dummy;
95549554
{
9555-
struct timespec req, rem;
9556-
95579555
for (;;) {
9556+
#ifdef HAVE_NANOSLEEP
9557+
struct timespec req, rem;
9558+
95589559
req.tv_sec = 0;
95599560
req.tv_nsec = 10000000;
95609561
nanosleep(&req, &rem);
9562+
#else
9563+
struct timeval tv;
9564+
tv.tv_sec = 0;
9565+
tv.tv_usec = 10000;
9566+
select(0, NULL, NULL, NULL, &tv);
9567+
#endif
95619568
if (!rb_thread_critical) {
95629569
rb_thread_pending = 1;
95639570
if (rb_trap_immediate) {

0 commit comments

Comments
 (0)