diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 1998-02-19 19:54:52 +0200 |
---|---|---|
committer | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1998-02-20 12:51:42 +0000 |
commit | d516a115cc96334486070e15a6babcd1278d8de9 (patch) | |
tree | 590f1929dc6a081deeb2172c4f6674a11c4e5f61 /ext | |
parent | 156620fa44a712d84367040dea35ac6eae776347 (diff) | |
download | perl-d516a115cc96334486070e15a6babcd1278d8de9.tar.gz |
retry [PATCH] 5.004_59: the perlhist.pod etc
p4raw-id: //depot/perl@557
Diffstat (limited to 'ext')
-rw-r--r-- | ext/Thread/Thread.pm | 32 | ||||
-rw-r--r-- | ext/Thread/Thread/Queue.pm | 13 | ||||
-rw-r--r-- | ext/Thread/Thread/Semaphore.pm | 19 | ||||
-rw-r--r-- | ext/Thread/Thread/Specific.pm | 11 |
4 files changed, 75 insertions, 0 deletions
diff --git a/ext/Thread/Thread.pm b/ext/Thread/Thread.pm index 48ca3047b9..cf7069c45d 100644 --- a/ext/Thread/Thread.pm +++ b/ext/Thread/Thread.pm @@ -8,6 +8,38 @@ $VERSION = "1.0"; @ISA = qw(Exporter DynaLoader); @EXPORT_OK = qw(yield cond_signal cond_broadcast cond_wait async); +=head1 NAME + +Thread - multithreading + +=head1 SYNOPSIS + + use Thread; + + my $t = new Thread \&start_sub, @start_args; + + $t->join; + + my $tid = Thread->self->tid; + + my $tlist = Thread->list; + + lock($scalar); + + use Thread 'async'; + + use Thread 'eval'; + +=head1 DESCRIPTION + +The C<Threads> module provides multithreading. + +=head1 SEE ALSO + +L<attrs>, L<Thread::Queue>, L<Thread::Semaphore>, L<Thread::Specific>. + +=cut + # # Methods # diff --git a/ext/Thread/Thread/Queue.pm b/ext/Thread/Thread/Queue.pm index 4eef978bd6..9821773aa4 100644 --- a/ext/Thread/Thread/Queue.pm +++ b/ext/Thread/Thread/Queue.pm @@ -1,6 +1,19 @@ package Thread::Queue; use Thread qw(cond_wait cond_broadcast); +=head1 NAME + +Thread::Queue - thread-safe queues + +=head1 SYNOPSIS + + use Thread::Queue; + my $q = new Thread::Queue; + $q->enqueue("foo", "bar"); + my $foo = $q->dequeue; # The "bar" is still in the queue. + +=cut + sub new { my $class = shift; return bless [@_], $class; diff --git a/ext/Thread/Thread/Semaphore.pm b/ext/Thread/Thread/Semaphore.pm index 9e5852f15c..4e1bb7ddbc 100644 --- a/ext/Thread/Thread/Semaphore.pm +++ b/ext/Thread/Thread/Semaphore.pm @@ -1,6 +1,25 @@ package Thread::Semaphore; use Thread qw(cond_wait cond_broadcast); +=head1 NAME + +Thread::Semaphore - thread-safe semaphores + +=head1 SYNOPSIS + + use Thread::Semaphore; + my $s = new Thread::Semaphore; + $s->up; # Also known as the semaphore V -operation. + # The guarded section is here + $s->down; # Also known as the semaphore P -operation. + + # The default semaphore value is 1. + my $s = new Thread::Semaphore($initial_value); + $s->up($up_value); + $s->down($up_value); + +=cut + sub new { my $class = shift; my $val = @_ ? shift : 1; diff --git a/ext/Thread/Thread/Specific.pm b/ext/Thread/Thread/Specific.pm index ec56539e40..c3591f4b94 100644 --- a/ext/Thread/Thread/Specific.pm +++ b/ext/Thread/Thread/Specific.pm @@ -1,5 +1,16 @@ package Thread::Specific; +=head1 NAME + +Thread::Specific - thread-specific keys + +=head1 SYNOPSIS + + use Thread::Specific; + my $k = key_create Thread::Specific; + +=cut + sub import { use attrs qw(locked method); require fields; |