New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] Upgrade to threads 2.06 #15288
Comments
From @jdheddenCreated by @jdheddenThe attached patch upgrades the 'threads' module to v2.06. The purpose of this patch is to sync blead and CPAN in This patch is in response to: The patch does not contain any functional changes. Perl Info
|
From @jdhedden0001-Upgrade-to-threads-2.06.patchFrom 9f79dec54bf6592718d054c0eaaf08af5d70fc36 Mon Sep 17 00:00:00 2001
From: jdhedden <jdhedden@cpan.org>
Date: Fri, 22 Apr 2016 14:28:09 -0400
Subject: [PATCH] Upgrade to threads 2.06
---
Porting/Maintainers.pl | 2 +-
dist/threads/lib/threads.pm | 17 +++++++++--------
dist/threads/t/exit.t | 10 +++++-----
dist/threads/t/thread.t | 2 +-
dist/threads/threads.xs | 28 +++++++++++++---------------
5 files changed, 29 insertions(+), 30 deletions(-)
diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl
index d861ccb..65e1602 100755
--- a/Porting/Maintainers.pl
+++ b/Porting/Maintainers.pl
@@ -1187,7 +1187,7 @@ use File::Glob qw(:case);
},
'threads' => {
- 'DISTRIBUTION' => 'JDHEDDEN/threads-2.02.tar.gz',
+ 'DISTRIBUTION' => 'JDHEDDEN/threads-2.06.tar.gz',
'FILES' => q[dist/threads],
'EXCLUDED' => [
qr{^examples/},
diff --git a/dist/threads/lib/threads.pm b/dist/threads/lib/threads.pm
index f4dee58..9feb4c3 100644
--- a/dist/threads/lib/threads.pm
+++ b/dist/threads/lib/threads.pm
@@ -134,7 +134,7 @@ threads - Perl interpreter-based threads
=head1 VERSION
-This document describes threads version 2.02
+This document describes threads version 2.06
=head1 WARNING
@@ -363,10 +363,10 @@ If you add the C<stringify> import option to your C<use threads> declaration,
then using a threads object in a string or a string context (e.g., as a hash
key) will cause its ID to be used as the value:
- use threads qw(stringify);
+ use threads qw(stringify);
- my $thr = threads->create(...);
- print("Thread $thr started...\n"); # Prints: Thread 1 started...
+ my $thr = threads->create(...);
+ print("Thread $thr started\n"); # Prints: Thread 1 started
=item threads->object($tid)
@@ -691,16 +691,17 @@ threaded applications.
To specify a particular stack size for any individual thread, call
C<-E<gt>create()> with a hash reference as the first argument:
- my $thr = threads->create({'stack_size' => 32*4096}, \&foo, @args);
+ my $thr = threads->create({'stack_size' => 32*4096},
+ \&foo, @args);
=item $thr2 = $thr1->create(FUNCTION, ARGS)
This creates a new thread (C<$thr2>) that inherits the stack size from an
existing thread (C<$thr1>). This is shorthand for the following:
- my $stack_size = $thr1->get_stack_size();
- my $thr2 = threads->create({'stack_size' => $stack_size},
- FUNCTION, ARGS);
+ my $stack_size = $thr1->get_stack_size();
+ my $thr2 = threads->create({'stack_size' => $stack_size},
+ FUNCTION, ARGS);
=back
diff --git a/dist/threads/t/exit.t b/dist/threads/t/exit.t
index 908f52c..016c135 100644
--- a/dist/threads/t/exit.t
+++ b/dist/threads/t/exit.t
@@ -48,7 +48,7 @@ my $rc = $thr->join();
ok(! defined($rc), 'Exited: threads->exit()');
-run_perl(prog => 'use threads 2.02;' .
+run_perl(prog => 'use threads 2.06;' .
'threads->exit(86);' .
'exit(99);',
nolib => ($ENV{PERL_CORE}) ? 0 : 1,
@@ -98,7 +98,7 @@ $rc = $thr->join();
ok(! defined($rc), 'Exited: $thr->set_thread_exit_only');
-run_perl(prog => 'use threads 2.02 qw(exit thread_only);' .
+run_perl(prog => 'use threads 2.06 qw(exit thread_only);' .
'threads->create(sub { exit(99); })->join();' .
'exit(86);',
nolib => ($ENV{PERL_CORE}) ? 0 : 1,
@@ -108,7 +108,7 @@ run_perl(prog => 'use threads 2.02 qw(exit thread_only);' .
is($?>>8, 86, "'use threads 'exit' => 'thread_only'");
}
-my $out = run_perl(prog => 'use threads 2.02;' .
+my $out = run_perl(prog => 'use threads 2.06;' .
'threads->create(sub {' .
' exit(99);' .
'});' .
@@ -124,7 +124,7 @@ my $out = run_perl(prog => 'use threads 2.02;' .
like($out, qr/1 finished and unjoined/, "exit(status) in thread");
-$out = run_perl(prog => 'use threads 2.02 qw(exit thread_only);' .
+$out = run_perl(prog => 'use threads 2.06 qw(exit thread_only);' .
'threads->create(sub {' .
' threads->set_thread_exit_only(0);' .
' exit(99);' .
@@ -141,7 +141,7 @@ $out = run_perl(prog => 'use threads 2.02 qw(exit thread_only);' .
like($out, qr/1 finished and unjoined/, "set_thread_exit_only(0)");
-run_perl(prog => 'use threads 2.02;' .
+run_perl(prog => 'use threads 2.06;' .
'threads->create(sub {' .
' $SIG{__WARN__} = sub { exit(99); };' .
' die();' .
diff --git a/dist/threads/t/thread.t b/dist/threads/t/thread.t
index 56087f3..c1218da 100644
--- a/dist/threads/t/thread.t
+++ b/dist/threads/t/thread.t
@@ -161,7 +161,7 @@ package main;
# bugid #24165
-run_perl(prog => 'use threads 2.02;' .
+run_perl(prog => 'use threads 2.06;' .
'sub a{threads->create(shift)} $t = a sub{};' .
'$t->tid; $t->join; $t->tid',
nolib => ($ENV{PERL_CORE}) ? 0 : 1,
diff --git a/dist/threads/threads.xs b/dist/threads/threads.xs
index d35eee1..5f52192 100644
--- a/dist/threads/threads.xs
+++ b/dist/threads/threads.xs
@@ -20,13 +20,12 @@
#endif
#ifdef HAS_PPPORT_H
# define NEED_PL_signals
-# define NEED_newRV_noinc
# define NEED_sv_2pv_flags
# include "ppport.h"
# include "threads.h"
#endif
#ifndef sv_dup_inc
-# define sv_dup_inc(s,t) SvREFCNT_inc(sv_dup(s,t))
+# define sv_dup_inc(s,t) SvREFCNT_inc(sv_dup(s,t))
#endif
#ifndef PERL_UNUSED_RESULT
# if defined(__GNUC__) && defined(HASATTRIBUTE_WARN_UNUSED_RESULT)
@@ -476,13 +475,13 @@ S_good_stack_size(pTHX_ IV stack_size)
return (stack_size);
}
-/* run some code within a JMPENV environment.
- * Having it in a separate small function helps avoid
- * 'variable ‘foo’ might be clobbered by ‘longjmp’
+
+/* Run code within a JMPENV environment.
+ * Using a separate function avoids
+ * "variable 'foo' might be clobbered by 'longjmp'"
* warnings.
* The three _p vars return values to the caller
*/
-
static int
S_jmpenv_run(pTHX_ int action, ithread *thread,
int *len_p, int *exit_app_p, int *exit_code_p)
@@ -496,12 +495,10 @@ S_jmpenv_run(pTHX_ int action, ithread *thread,
if (action == 0) {
/* Run the specified function */
*len_p = (int)call_sv(thread->init_function, thread->gimme|G_EVAL);
- }
- else if (action == 1) {
+ } else if (action == 1) {
/* Warn that thread died */
Perl_warn(aTHX_ "Thread %" UVuf " terminated abnormally: %" SVf, thread->tid, ERRSV);
- }
- else {
+ } else {
/* Warn if there are unjoined threads */
S_exit_warning(aTHX);
}
@@ -1018,8 +1015,9 @@ S_ithread_create(
my_pool->running_threads++;
MUTEX_UNLOCK(&my_pool->create_destruct_mutex);
return (thread);
-CLANG_DIAG_IGNORE(-Wthread-safety);
-/* warning: mutex 'thread->mutex' is not held on every path through here [-Wthread-safety-analysis] */
+
+ CLANG_DIAG_IGNORE(-Wthread-safety);
+ /* warning: mutex 'thread->mutex' is not held on every path through here [-Wthread-safety-analysis] */
}
#if defined(__clang__) || defined(__clang)
CLANG_DIAG_RESTORE;
@@ -1161,10 +1159,10 @@ ithread_create(...)
/* Let thread run. */
/* See S_ithread_run() for more detail. */
- CLANG_DIAG_IGNORE(-Wthread-safety);
- /* warning: releasing mutex 'thread->mutex' that was not held [-Wthread-safety-analysis] */
+ CLANG_DIAG_IGNORE(-Wthread-safety);
+ /* warning: releasing mutex 'thread->mutex' that was not held [-Wthread-safety-analysis] */
MUTEX_UNLOCK(&thread->mutex);
- CLANG_DIAG_RESTORE;
+ CLANG_DIAG_RESTORE;
/* XSRETURN(1); - implied */
--
2.8.1
|
From @rjbsThanks. I have applied this, but to satisfy porting tests, the version has been bumped to v2.07. I hope not to make any further changes in blead before v5.24.0, due any day now. |
The RT System itself - Status changed from 'new' to 'open' |
@rjbs - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#127961 (status was 'resolved')
Searchable as RT127961$
The text was updated successfully, but these errors were encountered: