From: Iain Truskett Date: Mon, 8 Jul 2002 13:53:59 +0000 (+1000) Subject: [DOC PATCH] perlthrtut.pod X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9e75ef81e1568429e0c4568e9b0c249c1402730d;p=p5sagit%2Fp5-mst-13.2.git [DOC PATCH] perlthrtut.pod Message-ID: <20020708035359.GB14168@eh.org> p4raw-id: //depot/perl@17417 --- diff --git a/pod/perlthrtut.pod b/pod/perlthrtut.pod index 583face..6dab7ed 100644 --- a/pod/perlthrtut.pod +++ b/pod/perlthrtut.pod @@ -29,8 +29,8 @@ class, while ithreads uses the L class. Note the change in case. The ithreads code has been available since Perl 5.6.0, and is considered stable. The user-level interface to ithreads (the L 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 @@ Future versions of Perl may fix this problem. =head2 Creating Threads The L 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 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 @@ C is a synonym for C. 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 @@ This is similar in feel to what happens when a UNIX process forks, 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 module and the C< : shared> attribute: @@ -533,7 +533,7 @@ Perl provides a number of mechanisms to coordinate the interactions 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; 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 @@ things we've covered. This program finds prime numbers using threads. 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