From: "Jerry D. Hedden" <jdhedden@cpan.org>
Message-ID: <
1ff86f510802221405w15277004u53e7e0a2d2603049@mail.gmail.com>
p4raw-id: //depot/perl@33361
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
use strict;
use warnings;
-our $VERSION = '2.04';
+our $VERSION = '2.07';
use threads::shared;
use Scalar::Util 1.10 qw(looks_like_number);
=head1 VERSION
-This document describes Thread::Semaphore version 2.04
+This document describes Thread::Semaphore version 2.07
=head1 SYNOPSIS
=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>
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;
--- /dev/null
+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