summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>1998-02-19 19:54:52 +0200
committerMalcolm Beattie <mbeattie@sable.ox.ac.uk>1998-02-20 12:51:42 +0000
commitd516a115cc96334486070e15a6babcd1278d8de9 (patch)
tree590f1929dc6a081deeb2172c4f6674a11c4e5f61 /ext
parent156620fa44a712d84367040dea35ac6eae776347 (diff)
downloadperl-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.pm32
-rw-r--r--ext/Thread/Thread/Queue.pm13
-rw-r--r--ext/Thread/Thread/Semaphore.pm19
-rw-r--r--ext/Thread/Thread/Specific.pm11
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;