summaryrefslogtreecommitdiff
path: root/signal.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-03 08:00:05 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-03 08:00:05 +0000
commit204929af9dfc7d483d69476325c1ceac1721e219 (patch)
treed06aba1c98e6b4d319551a42c8b5d7c464b621f4 /signal.c
parent028c1b16c277b87179171a94a0d600c3d45b606b (diff)
* include/ruby/signal.h: removed.
* common.mk, class.c, eval.c, eval_intern.h, file.c, gc.c, hash.c, io.c, process.c, signal.c: vm_core.h: ditto. Some unused external global variables are also removed. (rb_prohibit_interrupt, rb_trap_immediate, rb_trap_pending, rb_thread_critical) * ext/openssl/ossl_ssl.c, ext/openssl/ossl_x509store.c, ext/readline/readline.c, ext/socket/depend, ext/socket/socket.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'signal.c')
-rw-r--r--signal.c41
1 files changed, 17 insertions, 24 deletions
diff --git a/signal.c b/signal.c
index b110e16..35c31ba 100644
--- a/signal.c
+++ b/signal.c
@@ -12,12 +12,28 @@
**********************************************************************/
#include "ruby/ruby.h"
-#include "ruby/signal.h"
#include "ruby/node.h"
#include "vm_core.h"
#include <signal.h>
#include <stdio.h>
+#ifdef _WIN32
+typedef LONG rb_atomic_t;
+
+# define ATOMIC_TEST(var) InterlockedExchange(&(var), 0)
+# define ATOMIC_SET(var, val) InterlockedExchange(&(var), (val))
+# define ATOMIC_INC(var) InterlockedIncrement(&(var))
+# define ATOMIC_DEC(var) InterlockedDecrement(&(var))
+
+#else
+typedef int rb_atomic_t;
+
+# define ATOMIC_TEST(var) ((var) ? ((var) = 0, 1) : 0)
+# define ATOMIC_SET(var, val) ((var) = (val))
+# define ATOMIC_INC(var) (++(var))
+# define ATOMIC_DEC(var) (--(var))
+#endif
+
#ifdef __BEOS__
#undef SIGBUS
#endif
@@ -393,13 +409,6 @@ static struct {
VALUE cmd;
int safe;
} trap_list[NSIG];
-static rb_atomic_t trap_pending_list[NSIG];
-#if 0
-static char rb_trap_accept_nativethreads[NSIG];
-#endif
-rb_atomic_t rb_trap_pending;
-rb_atomic_t rb_trap_immediate;
-int rb_prohibit_interrupt = 1;
VALUE
rb_get_trap_cmd(int sig)
@@ -641,22 +650,6 @@ rb_signal_exec(rb_thread_t *th, int sig)
}
}
-void
-rb_trap_exec(void)
-{
-#ifndef MACOS_UNUSE_SIGNAL
- int i;
-
- for (i=0; i<NSIG; i++) {
- if (trap_pending_list[i]) {
- trap_pending_list[i] = 0;
- rb_signal_exec(GET_THREAD(), i);
- }
- }
-#endif /* MACOS_UNUSE_SIGNAL */
- rb_trap_pending = 0;
-}
-
struct trap_arg {
#if USE_TRAP_MASK
# ifdef HAVE_SIGPROCMASK