diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-20 15:45:15 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-20 15:45:15 +0000 |
commit | e91e9e7bbf1d93cdff89878b776a7824a9bc2d99 (patch) | |
tree | db5ce495631901ac5458a7373cfcb0bae9e2fc56 | |
parent | bb4f36de3a032909c90f6fa72f2134f198958145 (diff) | |
download | ruby-e91e9e7bbf1d93cdff89878b776a7824a9bc2d99.tar.gz |
* eval.c (rb_with_disable_interrupt): prohibit thread context
switch during proc execution. [ruby-dev:21899]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | dln.c | 2 | ||||
-rw-r--r-- | eval.c | 12 | ||||
-rw-r--r-- | ext/tcltklib/tcltklib.c | 8 | ||||
-rw-r--r-- | missing/isinf.c | 28 | ||||
-rw-r--r-- | missing/isnan.c | 24 | ||||
-rw-r--r-- | numeric.c | 7 |
8 files changed, 53 insertions, 35 deletions
@@ -25,6 +25,11 @@ Sat Dec 20 11:40:10 2003 Nobuyoshi Nakada <nobu@ruby-lang.org> * lib/yaml.rb (YAML::YAML): adjust Marshal version. +Sat Dec 20 03:56:02 2003 Yukihiro Matsumoto <matz@ruby-lang.org> + + * eval.c (rb_with_disable_interrupt): prohibit thread context + switch during proc execution. [ruby-dev:21899] + Sat Dec 20 02:41:02 2003 GOTOU Yuuzou <gotoyuzo@notwork.org> * lib/webrick/cgi.rb: add file. (yet another CGI library) diff --git a/configure.in b/configure.in index ee6cf7bb94..88be09ef9f 100644 --- a/configure.in +++ b/configure.in @@ -379,7 +379,7 @@ AC_FUNC_FSEEKO AC_CHECK_FUNCS(ftello) AC_REPLACE_FUNCS(dup2 memmove mkdir strcasecmp strncasecmp strerror strftime\ strchr strstr strtoul crypt flock vsnprintf\ - isinf isnan finite hypot acosh erf) + isnan finite isinf hypot acosh erf) AC_CHECK_FUNCS(fmod killpg wait4 waitpid syscall chroot fsync getcwd\ truncate chsize times utimes fcntl lockf lstat symlink readlink\ setitimer setruid seteuid setreuid setresuid setproctitle\ @@ -91,7 +91,7 @@ char *getenv(); int eaccess(); -#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(_AIX) && !defined(__APPLE__) ++#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(_AIX) && !defined(__APPLE__) && !defined(_UNICOSMP) /* dynamic load with dlopen() */ # define USE_DLN_DLOPEN #endif @@ -4739,11 +4739,13 @@ rb_with_disable_interrupt(proc, data) int status; DEFER_INTS; - PUSH_TAG(PROT_NONE); - if ((status = EXEC_TAG()) == 0) { - result = (*proc)(data); - } - POP_TAG(); + RUBY_CRITICAL( + PUSH_TAG(PROT_NONE); + if ((status = EXEC_TAG()) == 0) { + result = (*proc)(data); + } + POP_TAG(); + ); ALLOW_INTS; if (status) JUMP_TAG(status); diff --git a/ext/tcltklib/tcltklib.c b/ext/tcltklib/tcltklib.c index 50c654d814..ad7e377b66 100644 --- a/ext/tcltklib/tcltklib.c +++ b/ext/tcltklib/tcltklib.c @@ -800,7 +800,7 @@ ip_ruby(clientData, interp, argc, argv) { VALUE res; int old_trapflag; - struct eval_body_arg arg; + struct eval_body_arg arg; int dummy; /* ruby command has 1 arg. */ @@ -817,7 +817,7 @@ ip_ruby(clientData, interp, argc, argv) arg.failed = 0; /* evaluate the argument string by ruby */ - DUMP2("rb_eval_string(%s)", arg); + DUMP2("rb_eval_string(%s)", arg.string); old_trapflag = rb_trap_immediate; res = rb_ensure(ip_ruby_eval_body, (VALUE)&arg, ip_ruby_eval_ensure, INT2FIX(old_trapflag)); @@ -1775,7 +1775,7 @@ eval_queue_handler(evPtr, flags) { struct eval_queue *q = (struct eval_queue *)evPtr; - DUMP2("do_eval_queue_handler : evPtr = %lx", evPtr); + DUMP2("do_eval_queue_handler : evPtr = %p", evPtr); DUMP2("eval queue_thread : %lx", rb_thread_current()); DUMP2("added by thread : %lx", q->thread); @@ -2176,7 +2176,7 @@ invoke_queue_handler(evPtr, flags) { struct invoke_queue *q = (struct invoke_queue *)evPtr; - DUMP2("do_invoke_queue_handler : evPtr = %lx", evPtr); + DUMP2("do_invoke_queue_handler : evPtr = %p", evPtr); DUMP2("invoke queue_thread : %lx", rb_thread_current()); DUMP2("added by thread : %lx", q->thread); diff --git a/missing/isinf.c b/missing/isinf.c index 38772ba4f1..1b09f11f19 100644 --- a/missing/isinf.c +++ b/missing/isinf.c @@ -9,16 +9,33 @@ int isinf(n) double n; { - if (IsNANorINF(n) && IsINF(n)) { - return 1; - } else { - return 0; - } + if (IsNANorINF(n) && IsINF(n)) { + return 1; + } + else { + return 0; + } } #else #include "config.h" + +#if defined(HAVE_FINITE) && defined(HAVE_ISNAN) + +#ifdef HAVE_IEEEFP_H +#include <ieeefp.h> +#endif + +int +isinf(n) + double n; +{ + return (!finite(x) && !isnan(x)) +} + +#else + #ifdef HAVE_STRING_H # include <string.h> #else @@ -44,3 +61,4 @@ isinf(n) || memcmp(&n, &ninf, sizeof n) == 0; } #endif +#endif diff --git a/missing/isnan.c b/missing/isnan.c index df424c2e61..459048e936 100644 --- a/missing/isnan.c +++ b/missing/isnan.c @@ -1,31 +1,17 @@ /* public domain rewrite of isnan(3) */ -#ifdef _MSC_VER - -#include <float.h> -int -isnan(n) - double n; -{ - return _isnan(n); -} - -#else - static int double_ne(); int isnan(n) - double n; + double n; { - return double_ne(n, n); + return double_ne(n, n); } -static -int +static int double_ne(n1, n2) - double n1, n2; + double n1, n2; { - return n1 != n2; + return n1 != n2; } -#endif @@ -19,6 +19,10 @@ #include <floatingpoint.h> #endif +#ifdef _UNICOSMP +#include <intrinsics.h> +#endif + #ifdef HAVE_FLOAT_H #include <float.h> #endif @@ -1828,6 +1832,9 @@ Init_Numeric() #if defined(__FreeBSD__) && __FreeBSD__ < 4 /* allow divide by zero -- Inf */ fpsetmask(fpgetmask() & ~(FP_X_DZ|FP_X_INV|FP_X_OFL)); +#elif defined(_UNICOSMP) + /* Turn off floating point exceptions for divide by zero, etc. */ + _set_Creg(0, 0); #endif id_coerce = rb_intern("coerce"); id_to_i = rb_intern("to_i"); |