mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* 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
This commit is contained in:
		
							parent
							
								
									bb4f36de3a
								
							
						
					
					
						commit
						e91e9e7bbf
					
				
					 8 changed files with 53 additions and 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. | 	* 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> | Sat Dec 20 02:41:02 2003  GOTOU Yuuzou  <gotoyuzo@notwork.org> | ||||||
| 
 | 
 | ||||||
| 	* lib/webrick/cgi.rb: add file. (yet another CGI library) | 	* lib/webrick/cgi.rb: add file. (yet another CGI library) | ||||||
|  |  | ||||||
|  | @ -379,7 +379,7 @@ AC_FUNC_FSEEKO | ||||||
| AC_CHECK_FUNCS(ftello) | AC_CHECK_FUNCS(ftello) | ||||||
| AC_REPLACE_FUNCS(dup2 memmove mkdir strcasecmp strncasecmp strerror strftime\ | AC_REPLACE_FUNCS(dup2 memmove mkdir strcasecmp strncasecmp strerror strftime\ | ||||||
| 		 strchr strstr strtoul crypt flock vsnprintf\ | 		 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\ | AC_CHECK_FUNCS(fmod killpg wait4 waitpid syscall chroot fsync getcwd\ | ||||||
| 	      truncate chsize times utimes fcntl lockf lstat symlink readlink\ | 	      truncate chsize times utimes fcntl lockf lstat symlink readlink\ | ||||||
| 	      setitimer setruid seteuid setreuid setresuid setproctitle\ | 	      setitimer setruid seteuid setreuid setresuid setproctitle\ | ||||||
|  |  | ||||||
							
								
								
									
										2
									
								
								dln.c
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								dln.c
									
										
									
									
									
								
							|  | @ -91,7 +91,7 @@ char *getenv(); | ||||||
| 
 | 
 | ||||||
| int eaccess(); | 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() */ | /* dynamic load with dlopen() */ | ||||||
| # define USE_DLN_DLOPEN | # define USE_DLN_DLOPEN | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
							
								
								
									
										12
									
								
								eval.c
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								eval.c
									
										
									
									
									
								
							|  | @ -4739,11 +4739,13 @@ rb_with_disable_interrupt(proc, data) | ||||||
|     int status; |     int status; | ||||||
| 
 | 
 | ||||||
|     DEFER_INTS; |     DEFER_INTS; | ||||||
|     PUSH_TAG(PROT_NONE); |     RUBY_CRITICAL( | ||||||
|     if ((status = EXEC_TAG()) == 0) { | 	PUSH_TAG(PROT_NONE); | ||||||
| 	result = (*proc)(data); | 	if ((status = EXEC_TAG()) == 0) { | ||||||
|     } | 	    result = (*proc)(data); | ||||||
|     POP_TAG(); | 	} | ||||||
|  | 	POP_TAG(); | ||||||
|  |     ); | ||||||
|     ALLOW_INTS; |     ALLOW_INTS; | ||||||
|     if (status) JUMP_TAG(status); |     if (status) JUMP_TAG(status); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -800,7 +800,7 @@ ip_ruby(clientData, interp, argc, argv) | ||||||
| { | { | ||||||
|     VALUE res; |     VALUE res; | ||||||
|     int old_trapflag; |     int old_trapflag; | ||||||
|      struct eval_body_arg arg; |     struct eval_body_arg arg; | ||||||
|     int  dummy; |     int  dummy; | ||||||
| 
 | 
 | ||||||
|     /* ruby command has 1 arg. */ |     /* ruby command has 1 arg. */ | ||||||
|  | @ -817,7 +817,7 @@ ip_ruby(clientData, interp, argc, argv) | ||||||
|     arg.failed = 0; |     arg.failed = 0; | ||||||
| 
 | 
 | ||||||
|     /* evaluate the argument string by ruby */ |     /* evaluate the argument string by ruby */ | ||||||
|     DUMP2("rb_eval_string(%s)", arg); |     DUMP2("rb_eval_string(%s)", arg.string); | ||||||
|     old_trapflag = rb_trap_immediate; |     old_trapflag = rb_trap_immediate; | ||||||
|     res = rb_ensure(ip_ruby_eval_body, (VALUE)&arg,  |     res = rb_ensure(ip_ruby_eval_body, (VALUE)&arg,  | ||||||
| 		    ip_ruby_eval_ensure, INT2FIX(old_trapflag)); | 		    ip_ruby_eval_ensure, INT2FIX(old_trapflag)); | ||||||
|  | @ -1775,7 +1775,7 @@ eval_queue_handler(evPtr, flags) | ||||||
| { | { | ||||||
|     struct eval_queue *q = (struct eval_queue *)evPtr; |     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("eval queue_thread : %lx", rb_thread_current()); | ||||||
|     DUMP2("added by thread : %lx", q->thread); |     DUMP2("added by thread : %lx", q->thread); | ||||||
| 
 | 
 | ||||||
|  | @ -2176,7 +2176,7 @@ invoke_queue_handler(evPtr, flags) | ||||||
| { | { | ||||||
|     struct invoke_queue *q = (struct invoke_queue *)evPtr; |     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("invoke queue_thread : %lx", rb_thread_current()); | ||||||
|     DUMP2("added by thread : %lx", q->thread); |     DUMP2("added by thread : %lx", q->thread); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -9,16 +9,33 @@ int | ||||||
| isinf(n) | isinf(n) | ||||||
|     double n; |     double n; | ||||||
| { | { | ||||||
|         if (IsNANorINF(n) && IsINF(n)) { |     if (IsNANorINF(n) && IsINF(n)) { | ||||||
|                 return 1; | 	return 1; | ||||||
|         } else { |     } | ||||||
|                 return 0; |     else { | ||||||
|         } | 	return 0; | ||||||
|  |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #else | #else | ||||||
| 
 | 
 | ||||||
| #include "config.h" | #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 | #ifdef HAVE_STRING_H | ||||||
| # include <string.h> | # include <string.h> | ||||||
| #else | #else | ||||||
|  | @ -44,3 +61,4 @@ isinf(n) | ||||||
| 	|| memcmp(&n, &ninf, sizeof n) == 0; | 	|| memcmp(&n, &ninf, sizeof n) == 0; | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | @ -1,31 +1,17 @@ | ||||||
| /* public domain rewrite of isnan(3) */ | /* 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(); | static int double_ne(); | ||||||
| 
 | 
 | ||||||
| int | int | ||||||
| isnan(n) | isnan(n) | ||||||
|   double n; |     double n; | ||||||
| { | { | ||||||
|   return double_ne(n, n); |     return double_ne(n, n); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static | static int | ||||||
| int |  | ||||||
| double_ne(n1, n2) | double_ne(n1, n2) | ||||||
|   double n1, n2; |     double n1, n2; | ||||||
| { | { | ||||||
|   return n1 != n2; |     return n1 != n2; | ||||||
| } | } | ||||||
| #endif |  | ||||||
|  |  | ||||||
|  | @ -19,6 +19,10 @@ | ||||||
| #include <floatingpoint.h> | #include <floatingpoint.h> | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | #ifdef _UNICOSMP | ||||||
|  | #include <intrinsics.h> | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| #ifdef HAVE_FLOAT_H | #ifdef HAVE_FLOAT_H | ||||||
| #include <float.h> | #include <float.h> | ||||||
| #endif | #endif | ||||||
|  | @ -1828,6 +1832,9 @@ Init_Numeric() | ||||||
| #if defined(__FreeBSD__) && __FreeBSD__ < 4 | #if defined(__FreeBSD__) && __FreeBSD__ < 4 | ||||||
|     /* allow divide by zero -- Inf */ |     /* allow divide by zero -- Inf */ | ||||||
|     fpsetmask(fpgetmask() & ~(FP_X_DZ|FP_X_INV|FP_X_OFL)); |     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 | #endif | ||||||
|     id_coerce = rb_intern("coerce"); |     id_coerce = rb_intern("coerce"); | ||||||
|     id_to_i = rb_intern("to_i"); |     id_to_i = rb_intern("to_i"); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 matz
						matz