[libmath-prime-util-perl] 05/11: Fix Win32 threading breakage

Partha P. Mukherjee ppm-guest at moszumanska.debian.org
Thu May 21 18:48:32 UTC 2015


This is an automated email from the git hooks/post-receive script.

ppm-guest pushed a commit to annotated tag v0.28
in repository libmath-prime-util-perl.

commit a217b6aec9ec5c96c3a7f4b28b943097a4a429d8
Author: Dana Jacobsen <dana at acm.org>
Date:   Tue May 21 10:22:34 2013 -0700

    Fix Win32 threading breakage
---
 Changes | 3 +++
 util.c  | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Changes b/Changes
index de73411..e97dbdb 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,9 @@ Revision history for Perl extension Math::Prime::Util.
 
 0.28 xx May 2013
 
+    - An optimization to nth_prime caused occasional threaded Win32 faults.
+      Adjust so this is avoided.
+
     - Yet another XS micro-speedup (PERL_NO_GET_CONTEXT)
 
     - forprimes { block } [begin,]end.  e.g.
diff --git a/util.c b/util.c
index 043c484..48d6ce0 100644
--- a/util.c
+++ b/util.c
@@ -646,7 +646,7 @@ UV _XS_nth_prime(UV n)
    * good approximation, use Lehmer's algorithm to get the count, then walk
    * backwards or sieve forwards.
    */
-  if (upper_limit <= 32*1024*30) {
+  if (upper_limit <= get_prime_cache(0, 0) || upper_limit <= 32*1024*30) {
     /* Generate a sieve and count. */
     segment_size = get_prime_cache(upper_limit, &cache_sieve) / 30;
     /* Count up everything in the cached sieve. */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git



More information about the Pkg-perl-cvs-commits mailing list