summaryrefslogtreecommitdiff
path: root/dist
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2023-03-01 13:16:21 +0100
committerYves Orton <demerphq@gmail.com>2023-03-02 20:19:09 +0800
commit9f3d08cd5c12c8828f3c240327b861f6a4ff5747 (patch)
treed9cd44a4c3e497e1fab75e0ae2da5e1475e89a32 /dist
parent793c3967c627135477eb7ae545e703cea4c3b2d0 (diff)
downloadperl-9f3d08cd5c12c8828f3c240327b861f6a4ff5747.tar.gz
dist/Thread-Semaphore - add missing build artifacts
Adds Changes, Makefile.PL, and examples/semaphore.pl Fixes this module for https://github.com/Perl/perl5/issues/20874
Diffstat (limited to 'dist')
-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
4 files changed, 121 insertions, 0 deletions
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