From: Gurusamy Sarathy Date: Sun, 9 May 1999 18:47:21 +0000 (+0000) Subject: additions to Thread.pm docs from Tuomas J. Lukka X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=23a4f76c7b4e9befc010af6833751bbc7c4d2038;p=p5sagit%2Fp5-mst-13.2.git additions to Thread.pm docs from Tuomas J. Lukka p4raw-id: //depot/perl@3347 --- diff --git a/ext/Thread/Thread.pm b/ext/Thread/Thread.pm index c8bca0d..1dacdc0 100644 --- a/ext/Thread/Thread.pm +++ b/ext/Thread/Thread.pm @@ -18,22 +18,29 @@ Thread - multithreading my $t = new Thread \&start_sub, @start_args; - $t->join; + $result = $t->join; + $result = $t->eval; + $t->detach; - my $tid = Thread->self->tid; + if($t->equal($another_thread)) { + # ... + } + my $tid = Thread->self->tid; my $tlist = Thread->list; lock($scalar); + yield(); use Thread 'async'; - use Thread 'eval'; - =head1 DESCRIPTION The C module provides multithreading support for perl. +WARNING: Threading is an experimental feature. Both the interface +and implementation are subject to change drastically. + =head1 FUNCTIONS =over 8 @@ -122,6 +129,11 @@ The C function works similarly to C. C, though, will unblock B the threads that are blocked in a C on the locked variable, rather than only one. +=item yield + +The C function allows another thread to take control of the +CPU. The exact results are implementation-dependent. + =back =head1 METHODS @@ -145,6 +157,18 @@ The C method wraps an C around a C, and so waits for a thread to exit, passing along any values the thread might have returned. Errors, of course, get placed into C<$@>. +=item detach + +C tells a thread that it is never going to be joined i.e. +that all traces of its existence can be removed once it stops running. +Errors in detached threads will not be visible anywhere - if you want +to catch them, you should use $SIG{__DIE__} or something like that. + +=item equal + +C tests whether two thread objects represent the same thread and +returns true if they do. + =item tid The C method returns the tid of a thread. The tid is a monotonically