/
usr
/
share
/
perl5
/
/usr/share/perl5
mkdir
upload
Name
Size
Mode
Actions
App/
-
0755
rm
Archive/
-
0755
rm
Attribute/
-
0755
rm
autodie/
-
0755
rm
B/
-
0755
rm
Carp/
-
0755
rm
CGI/
-
0755
rm
Class/
-
0755
rm
Config/
-
0755
rm
CPAN/
-
0755
rm
CPANPLUS/
-
0755
rm
DBIx/
-
0755
rm
DBM_Filter/
-
0755
rm
Devel/
-
0755
rm
Digest/
-
0755
rm
Encode/
-
0755
rm
encoding/
-
0755
rm
Exporter/
-
0755
rm
ExtUtils/
-
0755
rm
File/
-
0755
rm
Filter/
-
0755
rm
Getopt/
-
0755
rm
HTML/
-
0755
rm
I18N/
-
0755
rm
IO/
-
0755
rm
IPC/
-
0755
rm
JSON/
-
0755
rm
Locale/
-
0755
rm
Log/
-
0755
rm
Math/
-
0755
rm
Memoize/
-
0755
rm
Module/
-
0755
rm
Net/
-
0755
rm
Object/
-
0755
rm
overload/
-
0755
rm
Package/
-
0755
rm
Params/
-
0755
rm
Parse/
-
0755
rm
PerlIO/
-
0755
rm
Pod/
-
0755
rm
pod/
-
0755
rm
Search/
-
0755
rm
TAP/
-
0755
rm
Term/
-
0755
rm
Test/
-
0755
rm
Test2/
-
0755
rm
Text/
-
0755
rm
Thread/
-
0755
rm
Tie/
-
0755
rm
Time/
-
0755
rm
Unicode/
-
0755
rm
unicore/
-
0755
rm
URI/
-
0755
rm
User/
-
0755
rm
vendor_perl/
-
0755
rm
version/
-
0755
rm
warnings/
-
0755
rm
abbrev.pl
838
0644
edit
dl
rm
AnyDBM_File.pm
2594
0644
edit
dl
rm
assert.pl
1298
0644
edit
dl
rm
attributes.pm
14877
0644
edit
dl
rm
autodie.pm
11763
0644
edit
dl
rm
AutoLoader.pm
14997
0644
edit
dl
rm
AutoSplit.pm
19637
0644
edit
dl
rm
autouse.pm
4238
0644
edit
dl
rm
base.pm
6986
0644
edit
dl
rm
Benchmark.pm
28530
0644
edit
dl
rm
bigfloat.pl
7368
0644
edit
dl
rm
bigint.pl
8959
0644
edit
dl
rm
bigint.pm
17852
0644
edit
dl
rm
bignum.pm
18673
0644
edit
dl
rm
bigrat.pl
4476
0644
edit
dl
rm
bigrat.pm
14442
0644
edit
dl
rm
blib.pm
2106
0644
edit
dl
rm
bytes.pm
2384
0644
edit
dl
rm
bytes_heavy.pl
758
0644
edit
dl
rm
cacheout.pl
1122
0644
edit
dl
rm
Carp.pm
7611
0644
edit
dl
rm
CGI.pm
261478
0644
edit
dl
rm
charnames.pm
15670
0644
edit
dl
rm
complete.pl
3191
0644
edit
dl
rm
constant.pm
12528
0644
edit
dl
rm
CORE.pod
1569
0644
edit
dl
rm
CPAN.pm
130907
0644
edit
dl
rm
CPANPLUS.pm
7269
0644
edit
dl
rm
ctime.pl
1993
0644
edit
dl
rm
DB.pm
19202
0644
edit
dl
rm
DBM_Filter.pm
14415
0644
edit
dl
rm
diagnostics.pm
17380
0644
edit
dl
rm
Digest.pm
10412
0644
edit
dl
rm
DirHandle.pm
1937
0644
edit
dl
rm
dotsh.pl
2175
0644
edit
dl
rm
Dumpvalue.pm
16899
0644
edit
dl
rm
dumpvar.pl
15275
0644
edit
dl
rm
English.pm
4488
0644
edit
dl
rm
Env.pm
5170
0644
edit
dl
rm
exceptions.pl
1736
0644
edit
dl
rm
Expect.pm
54725
0644
edit
dl
rm
Expect.pod
43735
0644
edit
dl
rm
Exporter.pm
18595
0644
edit
dl
rm
fastcwd.pl
1019
0644
edit
dl
rm
Fatal.pm
40966
0644
edit
dl
rm
feature.pm
5092
0644
edit
dl
rm
fields.pm
9507
0644
edit
dl
rm
FileCache.pm
5570
0644
edit
dl
rm
FileHandle.pm
6778
0644
edit
dl
rm
filetest.pm
4003
0644
edit
dl
rm
find.pl
1185
0644
edit
dl
rm
FindBin.pm
5658
0644
edit
dl
rm
finddepth.pl
1130
0644
edit
dl
rm
flush.pl
642
0644
edit
dl
rm
getcwd.pl
1427
0644
edit
dl
rm
getopt.pl
1322
0644
edit
dl
rm
getopts.pl
1406
0644
edit
dl
rm
hostname.pl
727
0644
edit
dl
rm
if.pm
1166
0644
edit
dl
rm
importenv.pl
283
0644
edit
dl
rm
integer.pm
3266
0644
edit
dl
rm
less.pm
3084
0644
edit
dl
rm
locale.pm
820
0644
edit
dl
rm
look.pl
1255
0644
edit
dl
rm
Memoize.pm
35295
0644
edit
dl
rm
newgetopt.pl
2213
0644
edit
dl
rm
NEXT.pm
18481
0644
edit
dl
rm
ok.pm
967
0444
edit
dl
rm
open.pm
7740
0644
edit
dl
rm
open2.pl
185
0644
edit
dl
rm
open3.pl
185
0644
edit
dl
rm
overload.pm
48050
0644
edit
dl
rm
overloading.pm
1801
0644
edit
dl
rm
parent.pm
2998
0644
edit
dl
rm
perl5db.pl
317682
0644
edit
dl
rm
PerlIO.pm
11122
0644
edit
dl
rm
pwd.pl
1478
0644
edit
dl
rm
Safe.pm
24326
0644
edit
dl
rm
SelectSaver.pm
1076
0644
edit
dl
rm
SelfLoader.pm
17341
0644
edit
dl
rm
Shell.pm
8685
0644
edit
dl
rm
shellwords.pl
276
0644
edit
dl
rm
sigtrap.pm
7611
0644
edit
dl
rm
sort.pm
6093
0644
edit
dl
rm
stat.pl
590
0644
edit
dl
rm
strict.pm
3716
0644
edit
dl
rm
subs.pm
842
0644
edit
dl
rm
Switch.pm
28508
0644
edit
dl
rm
Symbol.pm
4794
0644
edit
dl
rm
syslog.pl
4806
0644
edit
dl
rm
tainted.pl
164
0644
edit
dl
rm
termcap.pl
4114
0644
edit
dl
rm
Test.pm
28800
0644
edit
dl
rm
Test2.pm
6393
0444
edit
dl
rm
Thread.pm
8285
0644
edit
dl
rm
timelocal.pl
690
0644
edit
dl
rm
UNIVERSAL.pm
6536
0644
edit
dl
rm
utf8.pm
6918
0644
edit
dl
rm
utf8_heavy.pl
8001
0644
edit
dl
rm
validate.pl
3731
0644
edit
dl
rm
vars.pm
2358
0644
edit
dl
rm
version.pm
1037
0644
edit
dl
rm
version.pod
12315
0644
edit
dl
rm
vmsish.pm
4328
0644
edit
dl
rm
warnings.pm
16133
0644
edit
dl
rm
Edit:
/usr/share/perl5/Thread.pm
(8285B)
package Thread; use strict; use warnings; no warnings 'redefine'; our $VERSION = '3.02'; $VERSION = eval $VERSION; BEGIN { use Config; if (! $Config{useithreads}) { die("This Perl not built to support threads\n"); } } use threads 'yield'; use threads::shared; require Exporter; our @ISA = qw(Exporter threads); our @EXPORT = qw(cond_wait cond_broadcast cond_signal); our @EXPORT_OK = qw(async yield); sub async (&;@) { return Thread->new(shift); } sub done { return ! shift->is_running(); } sub eval { die("'eval' not implemented with 'ithreads'\n"); }; sub flags { die("'flags' not implemented with 'ithreads'\n"); }; 1; __END__ =head1 NAME Thread - Manipulate threads in Perl (for old code only) =head1 DEPRECATED The C<Thread> module served as the frontend to the old-style thread model, called I<5005threads>, that was introduced in release 5.005. That model was deprecated, and has been removed in version 5.10. For old code and interim backwards compatibility, the C<Thread> module has been reworked to function as a frontend for the new interpreter threads (I<ithreads>) model. However, some previous functionality is not available. Further, the data sharing models between the two thread models are completely different, and anything to do with data sharing has to be thought differently. With I<ithreads>, you must explicitly C<share()> variables between the threads. You are strongly encouraged to migrate any existing threaded code to the new model (i.e., use the C<threads> and C<threads::shared> modules) as soon as possible. =head1 HISTORY In Perl 5.005, the thread model was that all data is implicitly shared, and shared access to data has to be explicitly synchronized. This model is called I<5005threads>. In Perl 5.6, a new model was introduced in which all is was thread local and shared access to data has to be explicitly declared. This model is called I<ithreads>, for "interpreter threads". In Perl 5.6, the I<ithreads> model was not available as a public API; only as an internal API that was available for extension writers, and to implement fork() emulation on Win32 platforms. In Perl 5.8, the I<ithreads> model became available through the C<threads> module, and the I<5005threads> model was deprecated. In Perl 5.10, the I<5005threads> model was removed from the Perl interpreter. =head1 SYNOPSIS use Thread qw(:DEFAULT async yield); my $t = Thread->new(\&start_sub, @start_args); $result = $t->join; $t->detach; if ($t->done) { $t->join; } if($t->equal($another_thread)) { # ... } yield(); my $tid = Thread->self->tid; lock($scalar); lock(@array); lock(%hash); my @list = Thread->list; =head1 DESCRIPTION The C<Thread> module provides multithreading support for Perl. =head1 FUNCTIONS =over 8 =item $thread = Thread->new(\&start_sub) =item $thread = Thread->new(\&start_sub, LIST) C<new> starts a new thread of execution in the referenced subroutine. The optional list is passed as parameters to the subroutine. Execution continues in both the subroutine and the code after the C<new> call. C<Thread->new> returns a thread object representing the newly created thread. =item lock VARIABLE C<lock> places a lock on a variable until the lock goes out of scope. If the variable is locked by another thread, the C<lock> call will block until it's available. C<lock> is recursive, so multiple calls to C<lock> are safe--the variable will remain locked until the outermost lock on the variable goes out of scope. Locks on variables only affect C<lock> calls--they do I<not> affect normal access to a variable. (Locks on subs are different, and covered in a bit.) If you really, I<really> want locks to block access, then go ahead and tie them to something and manage this yourself. This is done on purpose. While managing access to variables is a good thing, Perl doesn't force you out of its living room... If a container object, such as a hash or array, is locked, all the elements of that container are not locked. For example, if a thread does a C<lock @a>, any other thread doing a C<lock($a[12])> won't block. Finally, C<lock> will traverse up references exactly I<one> level. C<lock(\$a)> is equivalent to C<lock($a)>, while C<lock(\\$a)> is not. =item async BLOCK; C<async> creates a thread to execute the block immediately following it. This block is treated as an anonymous sub, and so must have a semi-colon after the closing brace. Like C<Thread->new>, C<async> returns a thread object. =item Thread->self The C<Thread-E<gt>self> function returns a thread object that represents the thread making the C<Thread-E<gt>self> call. =item Thread->list Returns a list of all non-joined, non-detached Thread objects. =item cond_wait VARIABLE The C<cond_wait> function takes a B<locked> variable as a parameter, unlocks the variable, and blocks until another thread does a C<cond_signal> or C<cond_broadcast> for that same locked variable. The variable that C<cond_wait> blocked on is relocked after the C<cond_wait> is satisfied. If there are multiple threads C<cond_wait>ing on the same variable, all but one will reblock waiting to reaquire the lock on the variable. (So if you're only using C<cond_wait> for synchronization, give up the lock as soon as possible.) =item cond_signal VARIABLE The C<cond_signal> function takes a locked variable as a parameter and unblocks one thread that's C<cond_wait>ing on that variable. If more than one thread is blocked in a C<cond_wait> on that variable, only one (and which one is indeterminate) will be unblocked. If there are no threads blocked in a C<cond_wait> on the variable, the signal is discarded. =item cond_broadcast VARIABLE The C<cond_broadcast> function works similarly to C<cond_signal>. C<cond_broadcast>, though, will unblock B<all> the threads that are blocked in a C<cond_wait> on the locked variable, rather than only one. =item yield The C<yield> function allows another thread to take control of the CPU. The exact results are implementation-dependent. =back =head1 METHODS =over 8 =item join C<join> waits for a thread to end and returns any values the thread exited with. C<join> will block until the thread has ended, though it won't block if the thread has already terminated. If the thread being C<join>ed C<die>d, the error it died with will be returned at this time. If you don't want the thread performing the C<join> to die as well, you should either wrap the C<join> in an C<eval> or use the C<eval> thread method instead of C<join>. =item detach C<detach> tells a thread that it is never going to be joined i.e. that all traces of its existence can be removed once it stops running. Errors in detached threads will not be visible anywhere - if you want to catch them, you should use $SIG{__DIE__} or something like that. =item equal C<equal> tests whether two thread objects represent the same thread and returns true if they do. =item tid The C<tid> method returns the tid of a thread. The tid is a monotonically increasing integer assigned when a thread is created. The main thread of a program will have a tid of zero, while subsequent threads will have tids assigned starting with one. =item done The C<done> method returns true if the thread you're checking has finished, and false otherwise. =back =head1 DEFUNCT The following were implemented with I<5005threads>, but are no longer available with I<ithreads>. =over 8 =item lock(\&sub) With 5005threads, you could also C<lock> a sub such that any calls to that sub from another thread would block until the lock was released. Also, subroutines could be declared with the C<:locked> attribute which would serialize access to the subroutine, but allowed different threads non-simultaneous access. =item eval The C<eval> method wrapped an C<eval> around a C<join>, and so waited for a thread to exit, passing along any values the thread might have returned and placing any errors into C<$@>. =item flags The C<flags> method returned the flags for the thread - an integer value corresponding to the internal flags for the thread. =back =head1 SEE ALSO L<threads>, L<threads::shared>, L<Thread::Queue>, L<Thread::Semaphore> =cut
Save
cmd:
run