Skip to content

Commit d9262b3

Browse files
jdheddenrjbs
authored andcommitted
Upgrade to threads 2.06
1 parent 8a355c1 commit d9262b3

File tree

5 files changed

+29
-30
lines changed

5 files changed

+29
-30
lines changed

Porting/Maintainers.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,7 @@ package Maintainers;
11871187
},
11881188

11891189
'threads' => {
1190-
'DISTRIBUTION' => 'JDHEDDEN/threads-2.02.tar.gz',
1190+
'DISTRIBUTION' => 'JDHEDDEN/threads-2.06.tar.gz',
11911191
'FILES' => q[dist/threads],
11921192
'EXCLUDED' => [
11931193
qr{^examples/},

dist/threads/lib/threads.pm

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ threads - Perl interpreter-based threads
134134
135135
=head1 VERSION
136136
137-
This document describes threads version 2.02
137+
This document describes threads version 2.06
138138
139139
=head1 WARNING
140140
@@ -363,10 +363,10 @@ If you add the C<stringify> import option to your C<use threads> declaration,
363363
then using a threads object in a string or a string context (e.g., as a hash
364364
key) will cause its ID to be used as the value:
365365
366-
use threads qw(stringify);
366+
use threads qw(stringify);
367367
368-
my $thr = threads->create(...);
369-
print("Thread $thr started...\n"); # Prints: Thread 1 started...
368+
my $thr = threads->create(...);
369+
print("Thread $thr started\n"); # Prints: Thread 1 started
370370
371371
=item threads->object($tid)
372372
@@ -691,16 +691,17 @@ threaded applications.
691691
To specify a particular stack size for any individual thread, call
692692
C<-E<gt>create()> with a hash reference as the first argument:
693693
694-
my $thr = threads->create({'stack_size' => 32*4096}, \&foo, @args);
694+
my $thr = threads->create({'stack_size' => 32*4096},
695+
\&foo, @args);
695696
696697
=item $thr2 = $thr1->create(FUNCTION, ARGS)
697698
698699
This creates a new thread (C<$thr2>) that inherits the stack size from an
699700
existing thread (C<$thr1>). This is shorthand for the following:
700701
701-
my $stack_size = $thr1->get_stack_size();
702-
my $thr2 = threads->create({'stack_size' => $stack_size},
703-
FUNCTION, ARGS);
702+
my $stack_size = $thr1->get_stack_size();
703+
my $thr2 = threads->create({'stack_size' => $stack_size},
704+
FUNCTION, ARGS);
704705
705706
=back
706707

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.02;' .
51+
run_perl(prog => 'use threads 2.06;' .
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.02 qw(exit thread_only);' .
101+
run_perl(prog => 'use threads 2.06 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.02 qw(exit thread_only);' .
108108
is($?>>8, 86, "'use threads 'exit' => 'thread_only'");
109109
}
110110

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

126126

127-
$out = run_perl(prog => 'use threads 2.02 qw(exit thread_only);' .
127+
$out = run_perl(prog => 'use threads 2.06 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.02 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.02;' .
144+
run_perl(prog => 'use threads 2.06;' .
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.02;' .
164+
run_perl(prog => 'use threads 2.06;' .
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 & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@
2020
#endif
2121
#ifdef HAS_PPPORT_H
2222
# define NEED_PL_signals
23-
# define NEED_newRV_noinc
2423
# define NEED_sv_2pv_flags
2524
# include "ppport.h"
2625
# include "threads.h"
2726
#endif
2827
#ifndef sv_dup_inc
29-
# define sv_dup_inc(s,t) SvREFCNT_inc(sv_dup(s,t))
28+
# define sv_dup_inc(s,t) SvREFCNT_inc(sv_dup(s,t))
3029
#endif
3130
#ifndef PERL_UNUSED_RESULT
3231
# if defined(__GNUC__) && defined(HASATTRIBUTE_WARN_UNUSED_RESULT)
@@ -476,13 +475,13 @@ S_good_stack_size(pTHX_ IV stack_size)
476475
return (stack_size);
477476
}
478477

479-
/* run some code within a JMPENV environment.
480-
* Having it in a separate small function helps avoid
481-
* 'variable ‘foo’ might be clobbered by ‘longjmp’
478+
479+
/* Run code within a JMPENV environment.
480+
* Using a separate function avoids
481+
* "variable 'foo' might be clobbered by 'longjmp'"
482482
* warnings.
483483
* The three _p vars return values to the caller
484484
*/
485-
486485
static int
487486
S_jmpenv_run(pTHX_ int action, ithread *thread,
488487
int *len_p, int *exit_app_p, int *exit_code_p)
@@ -496,12 +495,10 @@ S_jmpenv_run(pTHX_ int action, ithread *thread,
496495
if (action == 0) {
497496
/* Run the specified function */
498497
*len_p = (int)call_sv(thread->init_function, thread->gimme|G_EVAL);
499-
}
500-
else if (action == 1) {
498+
} else if (action == 1) {
501499
/* Warn that thread died */
502500
Perl_warn(aTHX_ "Thread %" UVuf " terminated abnormally: %" SVf, thread->tid, ERRSV);
503-
}
504-
else {
501+
} else {
505502
/* Warn if there are unjoined threads */
506503
S_exit_warning(aTHX);
507504
}
@@ -1018,8 +1015,9 @@ S_ithread_create(
10181015
my_pool->running_threads++;
10191016
MUTEX_UNLOCK(&my_pool->create_destruct_mutex);
10201017
return (thread);
1021-
CLANG_DIAG_IGNORE(-Wthread-safety);
1022-
/* warning: mutex 'thread->mutex' is not held on every path through here [-Wthread-safety-analysis] */
1018+
1019+
CLANG_DIAG_IGNORE(-Wthread-safety);
1020+
/* warning: mutex 'thread->mutex' is not held on every path through here [-Wthread-safety-analysis] */
10231021
}
10241022
#if defined(__clang__) || defined(__clang)
10251023
CLANG_DIAG_RESTORE;
@@ -1161,10 +1159,10 @@ ithread_create(...)
11611159

11621160
/* Let thread run. */
11631161
/* See S_ithread_run() for more detail. */
1164-
CLANG_DIAG_IGNORE(-Wthread-safety);
1165-
/* warning: releasing mutex 'thread->mutex' that was not held [-Wthread-safety-analysis] */
1162+
CLANG_DIAG_IGNORE(-Wthread-safety);
1163+
/* warning: releasing mutex 'thread->mutex' that was not held [-Wthread-safety-analysis] */
11661164
MUTEX_UNLOCK(&thread->mutex);
1167-
CLANG_DIAG_RESTORE;
1165+
CLANG_DIAG_RESTORE;
11681166

11691167
/* XSRETURN(1); - implied */
11701168

0 commit comments

Comments
 (0)