Hi,

In message "Re: --enable-pthread still segfaults..."
    on 03/12/24, Nathaniel Talbott <nathaniel / talbott.ws> writes:

|Let me know if there's anything else I can do to help,

Can you try this patch?

--- rubysig.h	22 Dec 2003 08:23:54 -0000	1.17
+++ rubysig.h	24 Dec 2003 01:11:10 -0000
@@ -28,2 +28,3 @@ typedef LONG rb_atomic_t;
 	ATOMIC_SET(rb_trap_immediate, trap_immediate);\
+	CHECK_INTS;\
 } while (0)
@@ -46,2 +47,3 @@ typedef int rb_atomic_t;
 # define TRAP_END rb_trap_immediate = trap_immediate;\
+  CHECK_INTS;\
 } while (0)
--- eval.c	23 Dec 2003 19:53:42 -0000	1.614
+++ eval.c	24 Dec 2003 01:11:11 -0000
@@ -8419,3 +8419,3 @@ rb_thread_save_context(th)
     MEMCPY(th->stk_ptr, th->stk_pos, VALUE, th->stk_len);
-#ifdef USE_CONTEXT
+#ifdef __ia64__
     {
@@ -8425,3 +8425,2 @@ rb_thread_save_context(th)
 	getcontext(&ctx);
-#ifdef __ia64__
 	bot = (VALUE*)__libc_ia64_register_backing_store_base;
@@ -8435,3 +8434,2 @@ rb_thread_save_context(th)
 	MEMCPY(th->bstr_ptr, (VALUE*)__libc_ia64_register_backing_store_base, VALUE, th->bstr_len);
-#endif
     }
@@ -9537,7 +9535,3 @@ static int thread_init = 0;
 
-#if defined(HAVE_LIBPTHREAD) && defined(_REENTRANT)
-# define PTHREAD_TIMER
-#endif
-
-#if defined(PTHREAD_TIMER) || defined(HAVE_SETITIMER)
+#if defined(_THREAD_SAFE)
 static void
@@ -9549,11 +9543,5 @@ catch_timer(sig)
 #endif
-    if (!rb_thread_critical) {
-	if (rb_trap_immediate) {
-	    rb_thread_schedule();
-	}
-	else rb_thread_pending = 1;
-    }
+    /* cause EINTR */
 }
 
-#ifdef PTHREAD_TIMER
 static pthread_t time_thread;
@@ -9570,3 +9558,8 @@ thread_timer(dummy)
 	nanosleep(&req, &rem);
-	pthread_kill(ruby_thid, SIGVTALRM);
+	if (!rb_thread_critical) {
+	    rb_thread_pending = 1;
+	    if (rb_trap_immediate) {
+		pthread_kill(ruby_thid, SIGVTALRM);
+	    }
+	}
     }
@@ -9583,3 +9576,16 @@ rb_thread_stop_timer()
 }
-#else  /* HAVE_SETITIMER */
+#elif defined(HAVE_SETITIMER)
+static void
+catch_timer(sig)
+    int sig;
+{
+#if !defined(POSIX_SIGNAL) && !defined(BSD_SIGNAL)
+    signal(sig, catch_timer);
+#endif
+    if (!rb_thread_critical) {
+	rb_thread_pending = 1;
+    }
+    /* cause EINTR */
+}
+
 void
@@ -9607,4 +9613,3 @@ rb_thread_stop_timer()
 }
-#endif
-#else  /* !(PTHREAD_TIMER || HAVE_SETITIMER) */
+#else  /* !(_THREAD_SAFE || HAVE_SETITIMER) */
 int rb_thread_tick = THREAD_TICK;
@@ -9631,3 +9636,3 @@ rb_thread_start_0(fn, arg, th)
 	thread_init = 1;
-#if defined(HAVE_SETITIMER) || defined(PTHREAD_TIMER)
+#if defined(HAVE_SETITIMER) || defined(_THREAD_SAFE)
 #if defined(POSIX_SIGNAL)
@@ -9638,3 +9643,3 @@ rb_thread_start_0(fn, arg, th)
 
-#ifdef PTHREAD_TIMER
+#ifdef _THREAD_SAFE
 	pthread_create(&time_thread, 0, thread_timer, 0);