Lines Matching refs:Thread
20 =head1 What Is A Thread Anyway?
204 =head1 Thread Basics
206 The core Thread module provides the basic functions you need to write
209 that, we'll go over some of the features of the Thread module that
212 =head2 Basic Thread Support
214 Thread support is a Perl compile-time option-it's something that's
254 The Thread package provides the tools you need to create new
256 it; use Thread imports all the pieces you need to create basic
261 use Thread;
263 $thr = new Thread \&sub1;
275 part of the C<Thread::new> call, like this:
277 use Thread;
279 $thr = new Thread \&sub1, "Param 1", "Param 2", $Param3;
280 $thr = new Thread \&sub1, @ParamList;
281 $thr = new Thread \&sub1, qw(Param1 Param2 $Param3);
291 Thread returns whatever the subroutine returns.
301 use Thread qw(async);
314 You'll notice we did a use Thread qw(async) in that example. async is
317 Thread::async. You'll also note that there's a semicolon after the
338 use Thread qw(yield async);
354 =head2 Waiting For A Thread To Exit
360 use Thread;
361 $thr = new Thread \&sub1;
364 print "Thread returned @ReturnData";
386 use Thread qw(async);
399 =head2 Ignoring A Thread
411 use Thread;
412 $thr = new Thread \&sub1; # Spawn the thread
452 =head2 Thread Pitfall: Races
457 use Thread;
459 $thr1 = Thread->new(\&sub1);
460 $thr2 = Thread->new(\&sub2);
480 use Thread qw(async);
500 use Thread qw(async);
543 =head2 Thread Pitfall: Deadlocks
549 use Thread qw(async yield);
595 use Thread qw(async);
596 use Thread::Queue;
598 my $DataQueue = new Thread::Queue;
611 You create the queue with new Thread::Queue. Then you can add lists of
645 use Thread qw(yield);
646 use Thread::Semaphore;
647 my $semaphore = new Thread::Semaphore;
650 $thr1 = new Thread \&sample_sub, 1;
651 $thr2 = new Thread \&sample_sub, 2;
652 $thr3 = new Thread \&sample_sub, 3;
725 Thread package uses these to provide several flavors of
742 use Thread qw(yield);
744 new Thread \&thread_sub, 1;
745 new Thread \&thread_sub, 2;
746 new Thread \&thread_sub, 3;
747 new Thread \&thread_sub, 4;
759 print "Thread $ThreadID calling sync_sub\n";
776 use Thread;
794 new Thread \&tester, $thrnum;
859 =head1 General Thread Utility Routines
866 =head2 What Thread Am I In?
868 The Thread->self method provides your program with a way to get an
872 =head2 Thread IDs
875 thread the object represents. Thread IDs are integers, with the main
888 Thread->list returns a list of thread objects, one for each thread
893 foreach $thr (Thread->list) {
895 if ($thr->tid && !Thread::equal($thr, Thread->self)) {
914 6 use Thread;
915 7 use Thread::Queue;
917 9 my $stream = new Thread::Queue;
918 10 my $kid = new Thread(\&check_num, $stream, 2);
930 22 my $downstream = new Thread::Queue;
937 29 $kid = new Thread(\&check_num, $downstream, $num);