Move the stack desire definition to thread.h.
Jarkko Hietaniemi [Wed, 16 May 2001 13:08:33 +0000 (13:08 +0000)]
p4raw-id: //depot/perl@10122

ext/Thread/Thread.xs
thread.h

index c3b94eb..b81ee26 100644 (file)
@@ -279,14 +279,19 @@ newthread (pTHX_ SV *startsv, AV *initargs, char *classname)
     if (!attr_inited) {
        attr_inited = 1;
        err = pthread_attr_init(&attr);
+#  ifdef THREAD_CREATE_NEEDS_STACK
+       if (err == 0)
+            err = pthread_attr_setstacksize(&attr, THREAD_CREATE_NEEDS_STACK);
+       if (err)
+           croak("panic: pthread_attr_setstacksize failed");
+#else
+       croak("panic: can't pthread_attr_setstacksize");
+#  endif
 #  ifdef PTHREAD_ATTR_SETDETACHSTATE
-#ifdef DGUX
-       if (err == 0)
-           err = pthread_attr_setstacksize(&attr, (1024*16));
-#endif
        if (err == 0)
            err = PTHREAD_ATTR_SETDETACHSTATE(&attr, attr_joinable);
-
+       if (err)
+           croak("panic: pthread_attr_setdetachstate failed");
 #  else
        croak("panic: can't pthread_attr_setdetachstate");
 #  endif
index 24e2a8d..99269a1 100644 (file)
--- a/thread.h
+++ b/thread.h
 #  endif
 #endif
 
+#ifdef DGUX
+#  define THREAD_CREATE_NEEDS_STACK (16*1024)
+#endif
+
 #ifdef I_MACH_CTHREADS
 
 /* cthreads interface */