summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MANIFEST7
-rw-r--r--Porting/exec-bit.txt1
-rw-r--r--dist/Thread-Semaphore/.gitignore1
-rw-r--r--dist/Thread-Semaphore/Changes45
-rw-r--r--dist/Thread-Semaphore/Makefile.PL40
-rwxr-xr-xdist/Thread-Semaphore/examples/semaphore.pl35
6 files changed, 127 insertions, 2 deletions
diff --git a/MANIFEST b/MANIFEST
index 8cb3784b38..a580456695 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -4083,13 +4083,16 @@ dist/Thread-Queue/t/08_nothreads.t Thread::Queue tests
dist/Thread-Queue/t/09_ended.t Thread::Queue tests
dist/Thread-Queue/t/10_timed.t Thread::Queue tests
dist/Thread-Queue/t/11_limit.t Thread::Queue tests
+dist/Thread-Semaphore/Changes History of changes for Thread::Semaphore
+dist/Thread-Semaphore/examples/semaphore.pl Thread::Semaphore example script
dist/Thread-Semaphore/lib/Thread/Semaphore.pm Thread-safe semaphores
+dist/Thread-Semaphore/Makefile.PL Build Thread::Semaphore
dist/Thread-Semaphore/t/01_basic.t Thread::Semaphore tests
dist/Thread-Semaphore/t/02_errs.t Thread::Semaphore tests
dist/Thread-Semaphore/t/03_nothreads.t Thread::Semaphore tests
dist/Thread-Semaphore/t/04_nonblocking.t Thread::Semaphore tests
-dist/Thread-Semaphore/t/05_force.t Thread::Semaphore tests
-dist/Thread-Semaphore/t/06_timed.t Thread::Semaphore tests
+dist/Thread-Semaphore/t/05_force.t Thread::Semaphore tests
+dist/Thread-Semaphore/t/06_timed.t Thread::Semaphore tests
dist/threads/hints/hpux.pl Hint file for HPUX
dist/threads/hints/linux.pl Hint file for Linux
dist/threads/lib/threads.pm ithreads
diff --git a/Porting/exec-bit.txt b/Porting/exec-bit.txt
index 64123ef04d..a6d515f364 100644
--- a/Porting/exec-bit.txt
+++ b/Porting/exec-bit.txt
@@ -68,3 +68,4 @@ Porting/updateAUTHORS.pl
Porting/valgrindpp.pl
Cross/generate_config_sh
Cross/warp
+dist/Thread-Semaphore/examples/semaphore.pl
diff --git a/dist/Thread-Semaphore/.gitignore b/dist/Thread-Semaphore/.gitignore
new file mode 100644
index 0000000000..e54624d60d
--- /dev/null
+++ b/dist/Thread-Semaphore/.gitignore
@@ -0,0 +1 @@
+!/Makefile.PL
diff --git a/dist/Thread-Semaphore/Changes b/dist/Thread-Semaphore/Changes
new file mode 100644
index 0000000000..984b629337
--- /dev/null
+++ b/dist/Thread-Semaphore/Changes
@@ -0,0 +1,45 @@
+Revision history for Perl extension Thread::Semaphore.
+
+2.13 Sat Aug 27 13:00:00 2016
+ - Added ->down_timed()
+
+2.12 Fri Dec 24 17:48:48 2010
+ - POD update
+
+2.11 Thu Jun 11 02:14:41 2010
+ - Added ->down_nb() and ->down_force()
+ - Skip argument validation when no argument
+ - Install in 'site' for Perl >= 5.011
+ - Test file changes for core
+
+2.09 Thu Jun 12 13:40:19 2008
+ - End all tests with exit(0) and fix SKIPs
+
+2.08 Mon May 19 17:03:33 2008
+ - Check for undef args
+
+2.07 Fri Feb 22 21:36:54 2008
+ - Allow installation on non-threaded Perls
+
+2.06 Wed Feb 20 17:19:31 2008
+ - Build/test updates
+
+2.05 Mon Feb 18 12:23:15 2008
+ - Install under 'perl' dir
+
+2.04 Fri Feb 15 15:14:30 2008
+ - Fix tests to work under Perl 5.8.0
+
+2.03 Thu Feb 14 20:05:30 2008
+ - Fix test failure
+
+2.02 Thu Feb 14 15:27:00 2008
+ - Argument validation
+ - Test suite
+
+2.01 Sep 02 06:40:00 2003
+ - Minor doc update
+
+2.00 Jul 12 16:32:00 2002
+ - Released as part of Perl 5.8.0
+
diff --git a/dist/Thread-Semaphore/Makefile.PL b/dist/Thread-Semaphore/Makefile.PL
new file mode 100644
index 0000000000..bf7e2f8acd
--- /dev/null
+++ b/dist/Thread-Semaphore/Makefile.PL
@@ -0,0 +1,40 @@
+# Module makefile for Thread::Semaphore (using ExtUtils::MakeMaker)
+
+require 5.008;
+
+use strict;
+use warnings;
+
+use ExtUtils::MakeMaker;
+
+# Construct make file
+WriteMakefile(
+ 'NAME' => 'Thread::Semaphore',
+ 'AUTHOR' => 'Jerry D. Hedden <jdhedden AT cpan DOT org>',
+ 'VERSION_FROM' => 'lib/Thread/Semaphore.pm',
+ 'ABSTRACT_FROM' => 'lib/Thread/Semaphore.pm',
+ 'PREREQ_PM' => {
+ 'threads::shared' => 0,
+ 'Scalar::Util' => 1.10,
+ 'Test::More' => 0.50,
+ },
+ 'INSTALLDIRS' => (($] < 5.011) ? 'perl' : 'site'),
+
+ ((ExtUtils::MakeMaker->VERSION() lt '6.25') ?
+ ('PL_FILES' => { }) : ()),
+ ((ExtUtils::MakeMaker->VERSION() gt '6.30') ?
+ ('LICENSE' => 'perl_5') : ()),
+);
+
+# Additional 'make' targets
+sub MY::postamble
+{
+ return <<'_EXTRAS_';
+fixfiles:
+ @dos2unix `cat MANIFEST`
+ @$(CHMOD) 644 `cat MANIFEST`
+ @$(CHMOD) 755 examples/*.pl
+_EXTRAS_
+}
+
+# EOF
diff --git a/dist/Thread-Semaphore/examples/semaphore.pl b/dist/Thread-Semaphore/examples/semaphore.pl
new file mode 100755
index 0000000000..b27a0d3ef9
--- /dev/null
+++ b/dist/Thread-Semaphore/examples/semaphore.pl
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use threads;
+use Thread::Semaphore;
+
+MAIN:
+{
+ # Create semaphore with count of 0
+ my $s = Thread::Semaphore->new(0);
+
+ # Create detached thread
+ threads->create(sub {
+ # Thread is blocked until released by main
+ $s->down();
+
+ # Thread does work
+ # ...
+
+ # Tell main that thread is finished
+ $s->up();
+ })->detach();
+
+ # Release thread to do work
+ $s->up();
+
+ # Wait for thread to finish
+ $s->down();
+}
+
+exit(0);
+
+# EOF