* builtin.c (builtin_ldiv): Needed when DISABLE_GC.
[cacao.git] / src / vm / signal.c
index e12cf40aaed6d7195e57e5d5d779d40a33c93d5f..f1f1b462b970606fc4ecfecbfb54ea29c6f4a9db 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: signal.c 7776 2007-04-19 21:31:47Z twisti $
+   $Id: signal.c 7831 2007-04-26 12:48:16Z twisti $
 
 */
 
 #endif
 
 
-/* global variables ***********************************************************/
-
-#if defined(ENABLE_THREADS)
-static threadobject *thread_signal;
-#endif
-
-
 /* function prototypes ********************************************************/
 
 void signal_handler_sighup(int sig, siginfo_t *siginfo, void *_p);
@@ -224,8 +217,14 @@ static void signal_thread(void)
        while (true) {
                /* just wait for a signal */
 
-               if (sigwait(&mask, &sig) != 0)
-                       vm_abort("signal_thread: sigwait failed: %s", strerror(errno));
+               /* XXX We don't check for an error here, although the man-page
+                  states sigwait does not return an error (which is wrong!),
+                  but it seems to make problems with Boehm-GC.  We should
+                  revisit this code with our new exact-GC. */
+
+/*             if (sigwait(&mask, &sig) != 0) */
+/*                     vm_abort("signal_thread: sigwait failed: %s", strerror(errno)); */
+               (void) sigwait(&mask, &sig);
 
                switch (sig) {
                case SIGINT:
@@ -267,15 +266,9 @@ bool signal_start_thread(void)
 
        name = utf_new_char("Signal Handler");
 
-       thread_signal = threads_create_thread(name);
-
-       if (thread_signal == NULL)
+       if (!threads_thread_start_internal(name, signal_thread))
                return false;
 
-       /* actually start the signal handler thread */
-
-       threads_start_thread(thread_signal, signal_thread);
-
        /* everything's ok */
 
        return true;