From cecdab3bf0e8b03cfdccb20fb5ae82c31fae623b Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 24 Dec 2003 19:38:15 +0000 Subject: [PATCH] * 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 --- ChangeLog | 13 ++++++++++++- configure.in | 4 ++++ eval.c | 13 ++++++++++--- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7aadcec001..ca22d797b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,18 @@ -Thu Dec 25 00:17:53 2003 Yukihiro Matsumoto +Thu Dec 25 04:00:44 2003 Yukihiro Matsumoto * stable version 1.8.1 released. +Thu Dec 25 00:17:53 2003 Yukihiro Matsumoto + + * 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] + Wed Dec 24 23:48:04 2003 NAKAMURA, Hiroshi * test/soap/test_basetype.rb, test/soap/marshal/test_marshal.rb diff --git a/configure.in b/configure.in index bab27ad065..456f653c9e 100644 --- a/configure.in +++ b/configure.in @@ -721,6 +721,10 @@ if test "$enable_pthread" = "yes"; then fi fi fi + AC_CHECK_FUNC(nanosleep) + if test "$ac_cv_func_nanosleep" = "no"; then + AC_CHECK_LIB(rt, nanosleep, AC_DEFINE(HAVE_NANOSLEEP)) + fi fi dnl default value for $KANJI diff --git a/eval.c b/eval.c index 9a6d342e43..839c0c0dd3 100644 --- a/eval.c +++ b/eval.c @@ -29,7 +29,7 @@ #endif #include -#if defined(HAVE_UCONTEXT_H) && (defined(__ia64__) || defined(HAVE_NATIVETHREAD)) +#if defined(HAVE_UCONTEXT_H) && (defined(__ia64__) || defined(HAVE_NATIVETHREAD)) && !defined(__stub_getcontext) #include #define USE_CONTEXT #else @@ -9552,12 +9552,19 @@ static void* thread_timer(dummy) void *dummy; { - struct timespec req, rem; - for (;;) { +#ifdef HAVE_NANOSLEEP + struct timespec req, rem; + req.tv_sec = 0; req.tv_nsec = 10000000; nanosleep(&req, &rem); +#else + struct timeval tv; + tv.tv_sec = 0; + tv.tv_usec = 10000; + select(0, NULL, NULL, NULL, &tv); +#endif if (!rb_thread_critical) { rb_thread_pending = 1; if (rb_trap_immediate) {