'threads' patch to fix threaded build on Win32
Jerry D. Hedden [Mon, 8 May 2006 10:23:33 +0000 (03:23 -0700)]
From: "Jerry D. Hedden" <jerry@hedden.us>
Message-ID: <20060508102333.fb30e530d17747c2b054d625b8945d88.1e447744fc.wbe@email.secureserver.net>

p4raw-id: //depot/perl@28134

ext/threads/Changes
ext/threads/README
ext/threads/threads.pm
ext/threads/threads.xs

index 6daa99e..032bca8 100755 (executable)
@@ -1,5 +1,8 @@
 Revision history for Perl extension threads.
 
+1.26 Mon May  8 13:18:29 EDT 2006
+       - Fix for Win32 build WRT page size
+
 1.25 Thu May  4 12:34:02 EDT 2006
        - Final sync with blead
        - Lock counters in tests
index a324595..6283135 100755 (executable)
@@ -1,4 +1,4 @@
-threads version 1.25
+threads version 1.26
 ====================
 
 This module needs perl 5.8.0 or later compiled with 'useithreads'.
index af2343b..6a28940 100755 (executable)
@@ -5,7 +5,7 @@ use 5.008;
 use strict;
 use warnings;
 
-our $VERSION = '1.25';
+our $VERSION = '1.26';
 my $XS_VERSION = $VERSION;
 $VERSION = eval $VERSION;
 
@@ -102,7 +102,7 @@ threads - Perl interpreter-based threads
 
 =head1 VERSION
 
-This document describes threads version 1.25
+This document describes threads version 1.26
 
 =head1 SYNOPSIS
 
@@ -502,7 +502,7 @@ L<threads> Discussion Forum on CPAN:
 L<http://www.cpanforum.com/dist/threads>
 
 Annotated POD for L<threads>:
-L<http://annocpan.org/~JDHEDDEN/threads-1.25/shared.pm>
+L<http://annocpan.org/~JDHEDDEN/threads-1.26/shared.pm>
 
 L<threads::shared>, L<perlthrtut>
 
index 9593781..83d1afa 100755 (executable)
@@ -32,6 +32,9 @@ typedef perl_os_thread pthread_t;
 #    define PERL_THREAD_DETACH(t) pthread_detach((t))
 #  endif
 #endif
+#if !defined(HAS_GETPAGESIZE) && defined(I_SYS_PARAM)
+#  include <sys/param.h>
+#endif
 
 /* Values for 'state' member */
 #define PERL_ITHR_JOINABLE      0
@@ -270,17 +273,13 @@ good_stack_size(pTHX_ IV stack_size)
 
     /* Round up to page size boundary */
     if (page_size <= 0) {
-#ifdef PL_mmap_page_size
-        page_size = PL_mmap_page_size;
-#else
-#  ifdef HAS_MMAP
-#    if defined(HAS_SYSCONF) && (defined(_SC_PAGESIZE) || defined(_SC_MMAP_PAGE_SIZE))
+#if defined(HAS_SYSCONF) && (defined(_SC_PAGESIZE) || defined(_SC_MMAP_PAGE_SIZE))
         SETERRNO(0, SS_NORMAL);
-#      ifdef _SC_PAGESIZE
+#  ifdef _SC_PAGESIZE
         page_size = sysconf(_SC_PAGESIZE);
-#      else
+#  else
         page_size = sysconf(_SC_MMAP_PAGE_SIZE);
-#      endif
+#  endif
         if ((long)page_size < 0) {
             if (errno) {
                 SV * const error = get_sv("@", FALSE);
@@ -290,20 +289,18 @@ good_stack_size(pTHX_ IV stack_size)
                 Perl_croak(aTHX_ "PANIC: sysconf: pagesize unknown");
             }
         }
-#    else
-#      ifdef HAS_GETPAGESIZE
+#else
+#  ifdef HAS_GETPAGESIZE
         page_size = getpagesize();
-#      else
-#        if defined(I_SYS_PARAM) && defined(PAGESIZE)
-        page_size = PAGESIZE;
-#        endif
-#      endif
-        if (page_size <= 0)
-            Perl_croak(aTHX_ "PANIC: bad pagesize %" IVdf, (IV)page_size);
-#    endif
 #  else
+#    if defined(I_SYS_PARAM) && defined(PAGESIZE)
+        page_size = PAGESIZE;
+#    else
         page_size = 8192;   /* A conservative default */
+#    endif
 #  endif
+        if (page_size <= 0)
+            Perl_croak(aTHX_ "PANIC: bad pagesize %" IVdf, (IV)page_size);
 #endif
     }
     stack_size = ((stack_size + (page_size - 1)) / page_size) * page_size;