Change 17417 by jhi@alpha on 2002/07/08 12:08:27 Subject: [DOC PATCH] perlthrtut.pod From: Iain Truskett <[EMAIL PROTECTED]> Date: Mon, 8 Jul 2002 13:53:59 +1000 Message-ID: <[EMAIL PROTECTED]>
Affected files ... .... //depot/perl/pod/perlthrtut.pod#22 edit Differences ... ==== //depot/perl/pod/perlthrtut.pod#22 (text) ==== Index: perl/pod/perlthrtut.pod --- perl/pod/perlthrtut.pod#21~17387~ Mon Jul 1 02:26:02 2002 +++ perl/pod/perlthrtut.pod Mon Jul 8 05:08:27 2002 @@ -29,8 +29,8 @@ The ithreads code has been available since Perl 5.6.0, and is considered stable. The user-level interface to ithreads (the L<threads> classes) -appeared in the 5.8.0 release, and as of this time is considered stable, -although as with all new features, should be treated with caution. +appeared in the 5.8.0 release, and as of this time is considered stable +although it should be treated with caution as with all new features. =head1 What Is A Thread Anyway? @@ -286,11 +286,11 @@ =head2 Creating Threads The L<threads> package provides the tools you need to create new -threads. Like any other module, you need to tell Perl you want to use +threads. Like any other module, you need to tell Perl that you want to use it; C<use threads> imports all the pieces you need to create basic threads. -The simplest, straightforward way to create a thread is with new(): +The simplest, most straightforward way to create a thread is with new(): use threads; @@ -334,7 +334,7 @@ There are times when you may find it useful to have a thread explicitly give up the CPU to another thread. Your threading package might not support preemptive multitasking for threads, for example, or -you may be doing something compute-intensive and want to make sure +you may be doing something processor-intensive and want to make sure that the user-interface thread gets called frequently. Regardless, there are times that you might want a thread to give up the processor. @@ -434,7 +434,7 @@ except that in this case, the data is just copied to a different part of memory within the same process rather than a real fork taking place. -To make use of threading however, one usually want the threads to share +To make use of threading however, one usually wants the threads to share at least some data between themselves. This is done with the L<threads::shared> module and the C< : shared> attribute: @@ -533,7 +533,7 @@ between themselves and their data, to avoid race conditions and the like. Some of these are designed to resemble the common techniques used in thread libraries such as C<pthreads>; others are Perl-specific. Often, the -standard techniques are clumsily and difficult to get right (such as +standard techniques are clumsy and difficult to get right (such as condition waits). Where possible, it is usually easier to use Perlish techniques such as queues, which remove some of the hard work involved. @@ -914,7 +914,7 @@ This program uses the pipeline model to generate prime numbers. Each thread in the pipeline has an input queue that feeds numbers to be checked, a prime number that it's responsible for, and an output queue -that into which it funnels numbers that have failed the check. If the thread +into which it funnels numbers that have failed the check. If the thread has a number that's failed its check and there's no child thread, then the thread must have found a new prime number. In that case, a new child thread is created for that prime and stuck on the end of the End of Patch.