ext/threads/t/stress_re.t Test with multiple threads, string cv argument and regexes.
ext/threads/t/stress_string.t Test with multiple threads, string cv argument.
ext/threads/t/thread.t General ithread tests from thr5005
-ext/threads/typemap ithreads
ext/Thread/sync2.tx Test thread synchronisation
ext/Thread/sync.tx Test thread synchronisation
ext/Thread/Thread/Signal.pm Start a thread to run signal handlers
Revision history for Perl extension threads.
+1.43 Fri Oct 6 15:12:07 EDT 2006
+ - Stringify threads objects
+ - Removed 'typemap' file
+
1.42 Mon Sep 18 11:17:13 EDT 2006
- Fixes to tests
- Move $threads::threads outside of BEGIN block
# Create Makefile
WriteMakefile(
'NAME' => 'threads',
- 'AUTHOR' => 'Artur Bergman <sky AT crucially DOT net>',
+ 'AUTHOR' => 'Artur Bergman, Jerry D. Hedden <jdhedden AT cpan DOT org>',
'VERSION_FROM' => 'threads.pm',
'ABSTRACT_FROM' => 'threads.pm',
'PM' => {
'threads.pm' => '$(INST_LIBDIR)/threads.pm',
},
'PREREQ_PM' => {
+ 'strict' => 0,
+ 'warnings' => 0,
+ 'overload' => 0,
+ 'Config' => 0,
+ 'Carp' => 0,
'XSLoader' => 0,
+
+ 'ExtUtils::testlib' => 0,
+ 'Hash::Util' => 0,
+ 'IO::File' => 0,
},
'INSTALLDIRS' => 'perl',
-threads version 1.42
+threads version 1.43
====================
This module exposes interpreter threads to the Perl level.
BEGIN {
$| = 1;
- print("1..32\n"); ### Number of tests that will be run ###
+ print("1..33\n"); ### Number of tests that will be run ###
};
use threads;
$thrx = threads->object(0);
ok(32, ! defined($thrx), 'No object');
+import threads 'stringify';
+$thr1 = threads->create(sub {});
+ok(33, "$thr1" eq $thr1->tid(), 'Stringify');
+$thr1->join();
+
# EOF
# bugid #24165
-run_perl(prog => 'use threads 1.42;' .
+run_perl(prog => 'use threads 1.43;' .
'sub a{threads->create(shift)} $t = a sub{};' .
'$t->tid; $t->join; $t->tid',
nolib => ($ENV{PERL_CORE}) ? 0 : 1,
use strict;
use warnings;
-our $VERSION = '1.42';
+our $VERSION = '1.43';
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
my $flag = shift;
$threads::thread_exit_only = $flag =~ /^thread/i;
+ } elsif ($sym =~ /^str/i) {
+ import overload ('""' => \&tid);
+
} elsif ($sym =~ /all/) {
push(@EXPORT, qw(yield));
=head1 VERSION
-This document describes threads version 1.42
+This document describes threads version 1.43
=head1 SYNOPSIS
- use threads ('yield', 'stack_size' => 64*4096, 'exit' => 'threads_only');
+ use threads ('yield',
+ 'stack_size' => 64*4096,
+ 'exit' => 'threads_only',
+ 'stringify');
sub start_thread {
my @args = @_;
# Get a thread's ID
$tid = threads->tid();
$tid = $thr->tid();
+ $tid = "$thr";
# Give other threads a chance to run
threads->yield();
Class method that allows a thread to obtain its own ID.
+=item "$thr"
+
+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);
+
+ my $thr = threads->create(...);
+ print("Thread $thr started...\n"); # Prints out: Thread 1 started...
+
=item threads->object($tid)
This will return the I<threads> object for the I<active> thread associated
L<http://www.cpanforum.com/dist/threads>
Annotated POD for L<threads>:
-L<http://annocpan.org/~JDHEDDEN/threads-1.42/threads.pm>
+L<http://annocpan.org/~JDHEDDEN/threads-1.43/threads.pm>
L<threads::shared>, L<perlthrtut>
+++ /dev/null
-ithread * T_ITHREAD
-
-INPUT
-T_ITHREAD
- $var = SV_to_ithread(aTHX_ $arg)
-
-OUTPUT
-T_ITHREAD
- ithread_to_SV(aTHX_ $arg, $var, classname, TRUE);