Regen toc.
[p5sagit/p5-mst-13.2.git] / pod / perlthrtut.pod
index ea54461..6fda10f 100644 (file)
@@ -331,7 +331,7 @@ Perl's threading package provides the yield() function that does
 this. yield() is pretty straightforward, and works like this:
 
     use threads; 
-       
+
     sub loop {
            my $thread = shift;
            my $foo = 50;
@@ -344,7 +344,7 @@ this. yield() is pretty straightforward, and works like this:
     my $thread1 = threads->new(\&loop, 'first');
     my $thread2 = threads->new(\&loop, 'second');
     my $thread3 = threads->new(\&loop, 'third');
-       
+
 It is important to remember that yield() is only a hint to give up the CPU,
 it depends on your hardware, OS and threading libraries what actually happens.
 Therefore it is important to note that one should not build the scheduling of 
@@ -433,7 +433,7 @@ L<threads::shared> module and the C< : shared> attribute:
     my $foo : shared = 1;
     my $bar = 1;
     threads->new(sub { $foo++; $bar++ })->join;
-    
+
     print "$foo\n";  #prints 2 since $foo is shared
     print "$bar\n";  #prints 1 since $bar is not shared
 
@@ -966,12 +966,20 @@ use a little more memory and are a little slower than ordinary variables.
 =head1 Threadsafety of System Libraries
 
 Whether various library calls are threadsafe is outside the control
-of Perl.  Calls often suffering from not being threadsafe include
+of Perl.  Calls often suffering from not being threadsafe include:
 localtime(), gmtime(), get{gr,host,net,proto,serv,pw}*(), readdir(),
-rand(), srand().  If the system Perl is compiled in has threadsafe
-variants of these calls, they will be used, but besides that, Perl is
-at the mercy of the thread safety or unsafety of the calls.  Please
-consult your C library call documentation.
+rand(), and srand() -- in general, calls that depend on some external
+state.
+
+If the system Perl is compiled in has threadsafe variants of such
+calls, they will be used.  Beyond that, Perl is at the mercy of
+the threadsafety or unsafety of the calls.  Please consult your
+C library call documentation.
+
+In some platforms the threadsafe interfaces may fail if the result
+buffer is too small (for example getgrent() may return quite large
+group member lists).  Perl will retry growing the result buffer
+a few times, but only up to 64k (for safety reasons).
 
 =head1 Conclusion