Penguin
Diff: perlthrtut(1)
EditPageHistoryDiffInfoLikePages

Differences between current version and predecessor to the previous major change of perlthrtut(1).

Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History

Newer page: version 2 Last edited on Monday, June 3, 2002 6:50:51 pm by perry
Older page: version 1 Last edited on Monday, June 3, 2002 6:50:51 pm by perry Revert
@@ -235,9 +235,9 @@
 you might find that things aren't quite what you expect. 
 It's very important to remember when dealing with Perl 
 threads that Perl Threads Are Not X Threads, for all values 
 of X. They aren't POSIX threads, or 
-DecThreads, or Java's Green threads, or Win32 threads. There 
+! DecThreads, or Java's Green threads, or Win32 threads. There 
 are similarities, and the broad concepts are the same, but 
 if you start looking for implementation details you're going 
 to be either disappointed or confused. Possibly 
 both. 
@@ -317,18 +317,18 @@
 A possibly-threaded program using a possibly-threaded module might have code like this: 
  
  
  use Config; 
-use MyMod; 
+use ! MyMod; 
  if ($Config{usethreads}) { 
 # We have threads 
-require MyMod_threaded;  
-import MyMod_threaded; 
+require ! MyMod_threaded;  
+import ! MyMod_threaded; 
 } else { 
-require MyMod_unthreaded;  
-import MyMod_unthreaded; 
+require ! MyMod_unthreaded;  
+import ! MyMod_unthreaded; 
 
-Since code that runs both with and without threads is usually pretty messy, it's best to isolate the thread-specific code in its own module. In our example above, that's what MyMod_threaded is, and it's only imported if we're running on a threaded Perl. 
+Since code that runs both with and without threads is usually pretty messy, it's best to isolate the thread-specific code in its own module. In our example above, that's what ! MyMod_threaded is, and it's only imported if we're running on a threaded Perl. 
  
  
 __Creating Threads__ 
  
@@ -358,9 +358,9 @@
  
  use Thread; 
 $Param3 = 
  sub sub1 { 
-my @InboundParameters = @_; 
+my @! InboundParameters = @_; 
 print 
 The subroutine runs like a normal Perl subroutine, and the call to new Thread returns whatever the subroutine returns. 
  
  
@@ -376,9 +376,9 @@
 ''eval()'', but into its own thread: 
  
  
  use Thread qw(async); 
- $LineCount = ; 
+ $! LineCount = ; 
  $thr = async { 
 while( 
  print 
 You'll notice we did a use Thread qw(async) in that example. async is not exported by default, so if you want it, you'll either need to import it before you use it or fully qualify it as Thread::async. You'll also note that there's a semicolon after the closing brace. That's because ''async()'' treats the following block as an anonymous subroutine, so the semicolon is necessary. 
@@ -425,9 +425,9 @@
  
  
  use Thread; 
 $thr = new Thread 
- @ReturnData = $thr- 
+ @! ReturnData = $thr- 
  sub sub1 { return 
 In the example above, the ''join()'' method returns as soon as the thread ends. In addition to waiting for a thread to finish and gathering up any values that the thread might have returned, ''join()'' also performs any OS cleanup necessary for the thread. That cleanup might be important, especially for long-running programs that spawn lots of threads. If you don't want the return values and don't want to wait for the thread to finish, you should call the ''detach()'' method instead. ''detach()'' is covered later in the article. 
  
  
@@ -641,12 +641,12 @@
  
  
  use Thread qw(async); 
 use Thread::Queue; 
- my $DataQueue = new Thread::Queue; 
+ my $! DataQueue = new Thread::Queue; 
 $thr = async { 
-while ($DataElement = $DataQueue-  
- $DataQueue- 
+while ($! DataElement = $! DataQueue-  
+ $! DataQueue- 
 You create the queue with new Thread::Queue. Then you can add lists of scalars onto the end with ''enqueue()'', and pop scalars off the front of it with ''dequeue()''. A queue has no fixed size, and can grow as needed to hold everything pushed on to it. 
  
  
 If a queue is empty, ''dequeue()'' blocks until another 
@@ -685,16 +685,16 @@
  
  use Thread qw(yield); 
 use Thread::Semaphore; 
 my $semaphore = new Thread::Semaphore; 
-$GlobalVariable = ; 
+$! GlobalVariable = ; 
  $thr1 = new Thread 
  sub sample_sub { 
-my $SubNumber = shift @_;  
-my $TryCount = 10;  
-my $LocalCopy; 
+my $! SubNumber = shift @_;  
+my $! TryCount = 10;  
+my $! LocalCopy; 
 sleep 1; 
-while ($TryCount--) { 
+while ($! TryCount--) { 
 $semaphore- 
 The three invocations of the subroutine all operate in sync. The semaphore, though, makes sure that only one thread is accessing the global variable at once. 
  
  
@@ -785,9 +785,9 @@
  
  use Thread qw(yield); 
  new Thread 
  sub sync_sub :locked { 
-my $CallingThread = shift @_; 
+my $! CallingThread = shift @_; 
 print 
  sub thread_sub { 
 my $ThreadID = shift @_; 
 print 
@@ -1022,9 +1022,9 @@
 __OS-Related References__ 
  
  
 Boykin, Joseph, David Kirschen, Alan Langerman, and Susan 
-LoVerso. Programming under Mach. Addison-Wesley, 1994, 
+! LoVerso. Programming under Mach. Addison-Wesley, 1994, 
 ISBN 0-201-52739-1. 
  
  
 Tanenbaum, Andrew S. Distributed Operating Systems. Prentice 
@@ -1045,9 +1045,9 @@
 0-201-31006-6. 
  
  
 Le Sergent, T. and B. Berthomieu. ``Incremental 
-MultiThreaded Garbage Collection on Virtually Shared Memory 
+! MultiThreaded Garbage Collection on Virtually Shared Memory 
 Architectures'' in Memory Management: Proc. of the 
 International Workshop IWMM 92, St. Malo, 
 France, September 1992, Yves Bekkers and Jacques Cohen, eds. 
 Springer, 1992, ISBN 3540-55940-X (real-life 
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.