Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 537e3ff

Browse files
committed
threads-2.22_01
with backcompat thread_locale_init()
1 parent e6175ee commit 537e3ff

File tree

8 files changed

+50
-25
lines changed

8 files changed

+50
-25
lines changed

Porting/Maintainers.pl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,8 @@ package Maintainers;
14731473
},
14741474

14751475
'threads' => {
1476-
'DISTRIBUTION' => 'JDHEDDEN/threads-2.16.tar.gz',
1476+
# https://github.com/rurban/threads/commits/cperl really
1477+
'DISTRIBUTION' => 'RURBAN/threads-2.22_01.tar.gz',
14771478
'FILES' => q[dist/threads],
14781479
'EXCLUDED' => [
14791480
qr{^examples/},
@@ -1485,7 +1486,7 @@ package Maintainers;
14851486
# test locale race #127708
14861487
# use old pod, tech. explanation: slow, rather use fork
14871488
# fix my_pool init in global destruction
1488-
'CUSTOMIZED' => [
1489+
'CUSTOMIZED' => [
14891490
qw( t/locale.t
14901491
lib/threads.pm
14911492
threads.xs

dist/Module-CoreList/lib/Module/CoreList.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17339,6 +17339,7 @@ for my $version ( sort { version_sort($a, $b) } keys %released ) {
1733917339
'Test::Harness' => '3.42_01',
1734017340
'Term::ReadKey' => '2.37_03',
1734117341
'Thread::Queue' => '3.13',
17342+
'threads' => '2.22_01',
1734217343
'Tie::Hash::NamedCapture' => '0.10_01',
1734317344
'Time::HiRes' => '1.9758_01',
1734417345
'Time::Local' => '1.28',

dist/threads/Changes

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
Revision history for Perl extension threads.
22

3+
2.22_01 Fri Sep 7 13:00:29 2018 +0200 rurban
4+
- locale safety backport
5+
6+
2.22 Tue Jan 23 01:14:04 2018 +0100
7+
- more locale safety from perl5
8+
9+
2.21 Mon Jan 22 20:09:07 EST 2018
10+
- Fix to CLANG macros
11+
- Can return subs from threads. See docs.
12+
- Sync from blead
13+
314
2.16 Sun May 7 22:32:59 2017
415
- Fix Clang macro backward compatibility per patch by Andy Grundman
516
- Sync from blead
@@ -10,6 +21,9 @@ Revision history for Perl extension threads.
1021
2.14 Sun Feb 26 21:14:26 2017
1122
- Sync from blead
1223

24+
2.13_01 Sun Mar 5 19:27:49 2017 +0100
25+
- locale safety from cperl
26+
1327
2.13 Sun Feb 26 17:59:01 2017
1428
- Added t/kill3.t to test that dir handles are thread-safe
1529

dist/threads/lib/threads.pm

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use 5.008;
55
use strict;
66
use warnings;
77

8-
our $VERSION = '2.22_01';
8+
our $VERSION = '2.22_01'; # remember to update version in POD!
99
my $XS_VERSION = $VERSION;
1010
$VERSION = eval $VERSION;
1111

@@ -29,8 +29,7 @@ $threads::threads = 1;
2929

3030
# Load the XS code
3131
require XSLoader;
32-
XSLoader::load('threads', $XS_VERSION);
33-
32+
XSLoader::load("threads", $XS_VERSION);
3433

3534
### Export ###
3635

@@ -134,7 +133,7 @@ threads - Perl interpreter-based threads
134133
135134
=head1 VERSION
136135
137-
This document describes threads version 2.21_01
136+
This document describes threads version 2.22_01 (with fixes from cperl)
138137
139138
=head1 WARNING
140139
@@ -953,11 +952,14 @@ setting.
953952
954953
=item Locales
955954
956-
Prior to Perl 5.28, locales could not be used with threads, due to various
957-
race conditions. Starting in that release, on systems that implement
958-
thread-safe locale functions, threads can be used, with some caveats.
959-
This includes Windows starting with Visual Studio 2005, and systems compatible
960-
with POSIX 2008. See L<perllocale/Multi-threaded operation>.
955+
Prior to Perl 5.28 or cperl 5.24 locales could not be used with
956+
threads, due to various race conditions. Starting with Perl 5.28 on
957+
systems that implement thread-safe locale functions, threads can be
958+
used even on perl5 with some caveats. Previously only with cperl,
959+
but perl5 still has many unsolved issues.
960+
This includes Windows starting with Visual Studio 2005, and systems
961+
compatible with POSIX 2008. See L<perllocale/Multi-threaded
962+
operation>.
961963
962964
Each thread (except the main thread) is started using the C locale. The main
963965
thread is started like all other Perl programs; see L<perllocale/ENVIRONMENT>.

dist/threads/t/exit.t

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ my $rc = $thr->join();
4848
ok(! defined($rc), 'Exited: threads->exit()');
4949

5050

51-
run_perl(prog => 'use threads 2.16;' .
51+
run_perl(prog => 'use threads 2.21;' .
5252
'threads->exit(86);' .
5353
'exit(99);',
5454
nolib => ($ENV{PERL_CORE}) ? 0 : 1,
@@ -98,7 +98,7 @@ $rc = $thr->join();
9898
ok(! defined($rc), 'Exited: $thr->set_thread_exit_only');
9999

100100

101-
run_perl(prog => 'use threads 2.16 qw(exit thread_only);' .
101+
run_perl(prog => 'use threads 2.21 qw(exit thread_only);' .
102102
'threads->create(sub { exit(99); })->join();' .
103103
'exit(86);',
104104
nolib => ($ENV{PERL_CORE}) ? 0 : 1,
@@ -108,7 +108,7 @@ run_perl(prog => 'use threads 2.16 qw(exit thread_only);' .
108108
is($?>>8, 86, "'use threads 'exit' => 'thread_only'");
109109
}
110110

111-
my $out = run_perl(prog => 'use threads 2.16;' .
111+
my $out = run_perl(prog => 'use threads 2.21;' .
112112
'threads->create(sub {' .
113113
' exit(99);' .
114114
'});' .
@@ -124,7 +124,7 @@ my $out = run_perl(prog => 'use threads 2.16;' .
124124
like($out, qr/1 finished and unjoined/, "exit(status) in thread");
125125

126126

127-
$out = run_perl(prog => 'use threads 2.16 qw(exit thread_only);' .
127+
$out = run_perl(prog => 'use threads 2.21 qw(exit thread_only);' .
128128
'threads->create(sub {' .
129129
' threads->set_thread_exit_only(0);' .
130130
' exit(99);' .
@@ -141,7 +141,7 @@ $out = run_perl(prog => 'use threads 2.16 qw(exit thread_only);' .
141141
like($out, qr/1 finished and unjoined/, "set_thread_exit_only(0)");
142142

143143

144-
run_perl(prog => 'use threads 2.16;' .
144+
run_perl(prog => 'use threads 2.21;' .
145145
'threads->create(sub {' .
146146
' $SIG{__WARN__} = sub { exit(99); };' .
147147
' die();' .

dist/threads/t/thread.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ package main;
161161

162162
# bugid #24165
163163

164-
run_perl(prog => 'use threads 2.16;' .
164+
run_perl(prog => 'use threads 2.21;' .
165165
'sub a{threads->create(shift)} $t = a sub{};' .
166166
'$t->tid; $t->join; $t->tid',
167167
nolib => ($ENV{PERL_CORE}) ? 0 : 1,

dist/threads/threads.xs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#endif
2121
#ifdef HAS_PPPORT_H
2222
# define NEED_PL_signals
23+
# define NEED_newRV_noinc
2324
# define NEED_sv_2pv_flags
2425
# include "ppport.h"
2526
# include "threads.h"
@@ -35,13 +36,20 @@
3536
# endif
3637
#endif
3738

39+
#if PERL_VERSION < 28
40+
#define thread_locale_init()
41+
#define thread_locale_term()
42+
#endif
43+
3844
#ifndef CLANG_DIAG_IGNORE
3945
# define CLANG_DIAG_IGNORE(x)
4046
# define CLANG_DIAG_RESTORE
4147
#endif
4248
#ifndef CLANG_DIAG_IGNORE_STMT
4349
# define CLANG_DIAG_IGNORE_STMT(x) CLANG_DIAG_IGNORE(x) NOOP
4450
# define CLANG_DIAG_RESTORE_STMT CLANG_DIAG_RESTORE NOOP
51+
# define CLANG_DIAG_IGNORE_DECL(x) CLANG_DIAG_IGNORE(x) dNOOP
52+
# define CLANG_DIAG_RESTORE_DECL CLANG_DIAG_RESTORE dNOOP
4553
#endif
4654

4755
#ifdef USE_ITHREADS
@@ -141,9 +149,9 @@ typedef struct {
141149
IV page_size;
142150
} my_pool_t;
143151

144-
#define dMY_POOL \
145-
SV *my_pool_sv = *hv_fetch(PL_modglobal, MY_POOL_KEY, \
146-
sizeof(MY_POOL_KEY)-1, TRUE); \
152+
#define dMY_POOL \
153+
SV *my_pool_sv = *hv_fetch(PL_modglobal, MY_POOL_KEY, \
154+
sizeof(MY_POOL_KEY)-1, TRUE); \
147155
my_pool_t *my_poolp = INT2PTR(my_pool_t*, SvUV(my_pool_sv))
148156

149157
#define MY_POOL_set \
@@ -1046,10 +1054,10 @@ S_ithread_create(
10461054
MUTEX_UNLOCK(&my_pool->create_destruct_mutex);
10471055
return (thread);
10481056

1049-
CLANG_DIAG_IGNORE(-Wthread-safety)
1057+
CLANG_DIAG_IGNORE_STMT(-Wthread-safety);
10501058
/* warning: mutex 'thread->mutex' is not held on every path through here [-Wthread-safety-analysis] */
10511059
}
1052-
CLANG_DIAG_RESTORE
1060+
CLANG_DIAG_RESTORE_DECL;
10531061

10541062
#endif /* USE_ITHREADS */
10551063

@@ -1852,7 +1860,6 @@ BOOT:
18521860
SV *my_pool_sv = *hv_fetch(PL_modglobal, MY_POOL_KEY,
18531861
sizeof(MY_POOL_KEY)-1, TRUE);
18541862
my_pool_t *my_poolp = (my_pool_t*)SvPVX(newSV(sizeof(my_pool_t)-1));
1855-
18561863
MY_CXT_INIT;
18571864

18581865
Zero(my_poolp, 1, my_pool_t);

t/porting/customized.dat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ lib dist/lib/lib_pm.PL 04a3dedbc657cac6c8db1faf2f0c6a7af328a23f
154154
parent cpan/parent/t/compile-time-file.t 3e77ec70c6e73121129f93cb35b7c64eb2244a52
155155
parent cpan/parent/t/parent-classfromclassfile.t 35cd01cc132734c0c6b3f078449d5f389d8ec330
156156
parent cpan/parent/t/parent-classfromfile.t d07fa9c555256958565b22bc6b7ac191a3de8f96
157-
threads dist/threads/lib/threads.pm 41851eadf0a612abbbf47bd5ee8c7583f72d8933
157+
threads dist/threads/lib/threads.pm 070834529ce90f9cd47f9113e0803f4f44f47629
158158
threads dist/threads/t/locale.t 9a2a5b43a39867590eb288d4a1759abac2052aa8
159-
threads dist/threads/threads.xs 3285711397bddf5b5e8ddc0669744d5f7a2a814f
159+
threads dist/threads/threads.xs 9d4c375efbcd56b57416c87406afec861bc01360
160160
threads::shared dist/threads-shared/t/waithires.t dc867159fd2fa8c09326cd7627f5a0635ca5e3b5
161161
version cpan/version/lib/version.pm 5c578896318efbc417130d977da356792954da03
162162
version cpan/version/lib/version/regex.pm ba583136e44d520d5a8636c85d27a007cd8d6f1e

0 commit comments

Comments
 (0)