* 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
This commit is contained in:
matz 2003-12-24 19:38:15 +00:00
Родитель 060f19e92c
Коммит cecdab3bf0
3 изменённых файлов: 26 добавлений и 4 удалений

Просмотреть файл

@ -1,7 +1,18 @@
Thu Dec 25 00:17:53 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
Thu Dec 25 04:00:44 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* stable version 1.8.1 released.
Thu Dec 25 00:17:53 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* 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 <nahi@ruby-lang.org>
* test/soap/test_basetype.rb, test/soap/marshal/test_marshal.rb

Просмотреть файл

@ -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

13
eval.c
Просмотреть файл

@ -29,7 +29,7 @@
#endif
#include <stdio.h>
#if defined(HAVE_UCONTEXT_H) && (defined(__ia64__) || defined(HAVE_NATIVETHREAD))
#if defined(HAVE_UCONTEXT_H) && (defined(__ia64__) || defined(HAVE_NATIVETHREAD)) && !defined(__stub_getcontext)
#include <ucontext.h>
#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) {