From: Jerry D. Hedden Date: Fri, 22 Feb 2008 17:05:55 +0000 (-0500) Subject: Thread::Semaphore 2.07 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0a7dbd1b0b868fd81c67ec19f2121ecd18d42cec;p=p5sagit%2Fp5-mst-13.2.git Thread::Semaphore 2.07 From: "Jerry D. Hedden" Message-ID: <1ff86f510802221405w15277004u53e7e0a2d2603049@mail.gmail.com> p4raw-id: //depot/perl@33361 --- diff --git a/MANIFEST b/MANIFEST index 033f908..2d10afb 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2816,6 +2816,7 @@ lib/Thread/Queue/t/07_lock.t Thread::Queue tests lib/Thread/Semaphore.pm Thread-safe semaphores lib/Thread/Semaphore/t/01_basic.t Thread::Semaphore tests lib/Thread/Semaphore/t/02_errs.t Thread::Semaphore tests +lib/Thread/Semaphore/t/03_nothreads.t Thread::Semaphore tests lib/Thread.t Thread extensions frontend tests lib/Tie/Array.pm Base class for tied arrays lib/Tie/Array/push.t Test for Tie::Array diff --git a/lib/Thread/Semaphore.pm b/lib/Thread/Semaphore.pm index d00da67..1e7fcff 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 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 Annotated POD for Thread::Semaphore: -L +L + +Source repository: +L L, L diff --git a/lib/Thread/Semaphore/t/02_errs.t b/lib/Thread/Semaphore/t/02_errs.t index a0129d2..3c8ba44 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 0000000..fdeab16 --- /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