Skip to content

Commit

Permalink
59
Browse files Browse the repository at this point in the history
  • Loading branch information
khwilliamson committed May 5, 2021
1 parent b6f3fbd commit 105e955
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
8 changes: 5 additions & 3 deletions lib/locale_threads.t
Expand Up @@ -26,14 +26,14 @@ $Data::Dumper::Deepcopy = 1;

plan(2);
my $debug = 0;
$debug = 1 if $^O =~ /MSWin32/i;
$debug = 0; #$^O =~ /MSWin32/i;
my $d = $^D;
$d |= 0x04000000|0x00100000 if $^O =~ /MSWin32/i; #if $debug;

my $thread_count = $^O =~ /linux/i ? 50 : 3;
$thread_count = 3;
my $iterations = 1000;
$iterations = 100 if $^O =~ /MSWin32/i;
$iterations = 50 if $^O =~ /MSWin32/i;
my $max_result_length = 10000;

# Estimate as to how long to allow a thread to be ready to roll after
Expand Down Expand Up @@ -541,7 +541,8 @@ SKIP: {
+ ($thread_count * $per_thread_startup))
* 1_000_000;
my $switches = "";
$switches = "switches => [ -DLv ]" if $debug;
$switches = "switches => [ -DU ]" if $^O =~ /MSWin32/i;; # if $debug;


# See if multiple threads can simultaneously change the locale, and give
# the expected radix results. On systems without a comma radix locale,
Expand Down Expand Up @@ -675,6 +676,7 @@ SKIP: {
} # Loop to do the remaining categories for this iteration
return 0 if \$errors; # But no more iterations if failure
study;
}
return 1; # Success
Expand Down
2 changes: 1 addition & 1 deletion locale.c
Expand Up @@ -3508,7 +3508,7 @@ S_my_localeconv(pTHX_ const int item)
# ifdef USE_LOCALE_NUMERIC

/* Add in NUMERIC */
with = newlocale(LC_CTYPE_MASK, PL_numeric_name, with);
with = newlocale(LC_NUMERIC_MASK, PL_numeric_name, with);

# endif

Expand Down
11 changes: 11 additions & 0 deletions pp.c
Expand Up @@ -650,6 +650,17 @@ PP(pp_study)
dSP; dTOPss;
STRLEN len;

#ifdef WIN32
# include "Sysinfoapi.h"
MEMORYSTATUSEX statex;
statex.dwLength = sizeof (statex);
GlobalMemoryStatusEx (&statex);

DEBUG_U(PerlIO_printf(Perl_debug_log, "%s:%d: %ld\n", __FILE__, __LINE__, statex.ullAvailVirtual));
#else
DEBUG_U(PerlIO_printf(Perl_debug_log, "%s:%d: %p\n", __FILE__, __LINE__, sbrk((intptr_t) 0)));
#endif

(void)SvPV(sv, len);
if (len == 0 || len > I32_MAX || !SvPOK(sv) || SvUTF8(sv) || SvVALID(sv)) {
/* Historically, study was skipped in these cases. */
Expand Down

0 comments on commit 105e955

Please sign in to comment.