summaryrefslogtreecommitdiff
path: root/lib/Thread
diff options
context:
space:
mode:
authorJerry D. Hedden <jdhedden@cpan.org>2008-02-22 12:05:55 -0500
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2008-02-25 06:53:19 +0000
commit0a7dbd1b0b868fd81c67ec19f2121ecd18d42cec (patch)
tree654c5e505e369ea0a6ed6794df8005fa17150db9 /lib/Thread
parent33d16ee73507a82920495bd827b79f06d56e1cb4 (diff)
downloadperl-0a7dbd1b0b868fd81c67ec19f2121ecd18d42cec.tar.gz
Thread::Semaphore 2.07
From: "Jerry D. Hedden" <jdhedden@cpan.org> Message-ID: <1ff86f510802221405w15277004u53e7e0a2d2603049@mail.gmail.com> p4raw-id: //depot/perl@33361
Diffstat (limited to 'lib/Thread')
-rw-r--r--lib/Thread/Semaphore.pm16
-rw-r--r--lib/Thread/Semaphore/t/02_errs.t5
-rw-r--r--lib/Thread/Semaphore/t/03_nothreads.t24
3 files changed, 37 insertions, 8 deletions
diff --git a/lib/Thread/Semaphore.pm b/lib/Thread/Semaphore.pm
index d00da678a9..1e7fcff3ff 100644
--- a/lib/Thread/Semaphore.pm
+++ b/lib/Thread/Semaphore.pm
@@ -3,7 +3,7 @@ package Thread::Semaphore;
use strict;
use warnings;
-our $VERSION = '2.04';
+our $VERSION = '2.07';
use threads::shared;
use Scalar::Util 1.10 qw(looks_like_number);
@@ -55,7 +55,7 @@ Thread::Semaphore - Thread-safe semaphores
=head1 VERSION
-This document describes Thread::Semaphore version 2.04
+This document describes Thread::Semaphore version 2.07
=head1 SYNOPSIS
@@ -127,13 +127,23 @@ word "vrij", which means "release").
=back
+=head1 NOTES
+
+Semaphores created by L<Thread::Semaphore> can be used in both threaded and
+non-threaded applications. This allows you to write modules and packages
+that potentially make use of semaphores, and that will function in either
+environment.
+
=head1 SEE ALSO
Thread::Semaphore Discussion Forum on CPAN:
L<http://www.cpanforum.com/dist/Thread-Semaphore>
Annotated POD for Thread::Semaphore:
-L<http://annocpan.org/~JDHEDDEN/Thread-Semaphore-2.04/lib/Thread/Semaphore.pm>
+L<http://annocpan.org/~JDHEDDEN/Thread-Semaphore-2.07/lib/Thread/Semaphore.pm>
+
+Source repository:
+L<http://code.google.com/p/thread-semaphore/>
L<threads>, L<threads::shared>
diff --git a/lib/Thread/Semaphore/t/02_errs.t b/lib/Thread/Semaphore/t/02_errs.t
index a0129d20d1..3c8ba440c1 100644
--- a/lib/Thread/Semaphore/t/02_errs.t
+++ b/lib/Thread/Semaphore/t/02_errs.t
@@ -6,11 +6,6 @@ BEGIN {
chdir('t');
unshift(@INC, '../lib');
}
- use Config;
- if (! $Config{'useithreads'}) {
- print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
- exit(0);
- }
}
use Thread::Semaphore;
diff --git a/lib/Thread/Semaphore/t/03_nothreads.t b/lib/Thread/Semaphore/t/03_nothreads.t
new file mode 100644
index 0000000000..fdeab1659a
--- /dev/null
+++ b/lib/Thread/Semaphore/t/03_nothreads.t
@@ -0,0 +1,24 @@
+use strict;
+use warnings;
+
+BEGIN {
+ if ($ENV{'PERL_CORE'}){
+ chdir('t');
+ unshift(@INC, '../lib');
+ }
+}
+
+use Test::More 'tests' => 4;
+
+use Thread::Semaphore;
+
+my $s = Thread::Semaphore->new();
+is($$s, 1, 'Non-threaded semaphore');
+$s->down();
+is($$s, 0, 'Non-threaded semaphore');
+$s->up(2);
+is($$s, 2, 'Non-threaded semaphore');
+$s->down();
+is($$s, 1, 'Non-threaded semaphore');
+
+# EOF