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?
=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;
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.
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:
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.
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