[svn-upgrade] new version libforks-perl (0.34)
Salvatore Bonaccorso
13 years ago
0 | 0.34 June 14 2010 | |
1 | ***** Bug fixes ***** | |
2 | ||
3 | Fix compatibility with perl 5.11 and later. (RT#56263) | |
4 | (Possible bug in core each() iterator, when using blessed globrefs as hash keys?) | |
5 | ||
6 | Main thread will no longer be ABRT signalled (to exit) if it is already shutting down. | |
7 | ||
8 | Fix usleep behavior on platforms without nanosleep support. (RT#52782) | |
9 | ||
10 | Fix test skip counts in forks08.t. (RT#52781) | |
11 | ||
12 | ***** Threads API consistency changes ***** | |
13 | ||
14 | Bumped threads $VERSION to 1.77, threads::shared $VERSION to 1.33 to match | |
15 | version-supported features and behavior. | |
16 | ||
17 | ***** Miscellaneous changes ***** | |
18 | ||
19 | Runtime 'require threads::shared' now correctly loads forks::shared in an ithreads-enabled | |
20 | Perl, as long as 'forks' was loaded first. Can default to the previous behavior with a | |
21 | true-value environment variable, THREADS_NO_PRELOAD_SHARED. (RT#56139) | |
22 | ||
23 | Use SvGETMAGIC macro instead of mg_get. | |
24 | ||
25 | Add module dependency requirements test. | |
26 | ||
27 | Updated to ppport.h 3.19. | |
28 | ||
0 | 29 | 0.33 April 8 2009 |
1 | 30 | ***** Bug fixes ***** |
2 | 31 |
17 | 17 | ppport.h |
18 | 18 | README |
19 | 19 | SIGNATURE |
20 | t/forks00-requirements.t | |
20 | 21 | t/forks00-sigtrap.t |
21 | 22 | t/forks01.t |
22 | 23 | t/forks02.t |
0 | 0 | --- #YAML:1.0 |
1 | 1 | name: forks |
2 | version: 0.33 | |
2 | version: 0.34 | |
3 | 3 | abstract: forks - emulate threads with fork |
4 | 4 | author: |
5 | 5 | - Eric Rybski (rybskej@yahoo.com) |
6 | 6 | license: unknown |
7 | 7 | distribution_type: module |
8 | 8 | configure_requires: |
9 | ExtUtils::MakeMaker: 0 | |
10 | build_requires: | |
9 | 11 | ExtUtils::MakeMaker: 0 |
10 | 12 | requires: |
11 | 13 | Acme::Damn: 0 |
24 | 26 | directory: |
25 | 27 | - t |
26 | 28 | - inc |
27 | generated_by: ExtUtils::MakeMaker version 6.48 | |
29 | generated_by: ExtUtils::MakeMaker version 6.56 | |
28 | 30 | meta-spec: |
29 | 31 | url: http://module-build.sourceforge.net/META-spec-v1.4.html |
30 | 32 | version: 1.4 |
0 | 0 | README for forks |
1 | 1 | |
2 | 2 | Version: |
3 | 0.33 | |
3 | 0.34 | |
4 | 4 | |
5 | 5 | The forks.pm module is a drop-in replacement for threads.pm. It has the |
6 | 6 | same syntax as the threads.pm module (it even takes over its namespace) but |
13 | 13 | -----BEGIN PGP SIGNED MESSAGE----- |
14 | 14 | Hash: SHA1 |
15 | 15 | |
16 | SHA1 d6fdbd833e0407ed07fe57dd6d697b57f8b84664 CHANGELOG | |
16 | SHA1 caf1c6cc98552b9d6d7fc024f3bcd3019497d5bd CHANGELOG | |
17 | 17 | SHA1 455b7ebe2265a00e97f133c8cd7ebf56148a573d CREDITS |
18 | SHA1 c918d4ed8f1acf452740801a33f6885e2c47d28e MANIFEST | |
18 | SHA1 3b891564aac2c35b5016ba3c6a5d0dfa67b78a62 MANIFEST | |
19 | 19 | SHA1 0a40de91b5f4169eef3ff3ef456a40b79d056e78 MANIFEST.skip |
20 | SHA1 696fbeb7ffb81e169e77edc28072e005cf54b288 META.yml | |
20 | SHA1 e65dfda52c048de13ac9f1c051cc3cbe585e8402 META.yml | |
21 | 21 | SHA1 24f37b818f36c8c93acf447c05dbb3804a9368ae Makefile.PL |
22 | SHA1 f7d6225860423f7dd7a81c18828dd2cdf2bfb5f3 README | |
23 | SHA1 10357d353c270dcdad97a24923845201778e97f7 TODO | |
22 | SHA1 e75a558d750f60a93c86932192fe982b0d410281 README | |
23 | SHA1 a4ab922a5133b93496f3e5f037b7f9b4684b7555 TODO | |
24 | 24 | SHA1 b8554457d862188bf4bce3639881d99617bc4529 VERSION |
25 | SHA1 8b16e73ade400e5915771b8548b5a0649911f840 forks.xs | |
26 | SHA1 99c811e52702ed51e88a5fa8b8a63c1736a502c2 lib/forks.pm | |
25 | SHA1 1c3548011fb1c9210eff34e2ab563e3d42059f29 forks.xs | |
26 | SHA1 a77f83a63b52a8fba82b6a321c5796a2b0e085c6 lib/forks.pm | |
27 | 27 | SHA1 5652c39f2420041f153dfab66fc4a3fc133a025f lib/forks/Devel/Symdump.pm |
28 | SHA1 74e5732b2bc87cbd2e43f9271f8656a987fced7b lib/forks/shared.pm | |
29 | SHA1 e3843abed8c10042e611358c6fd814364ccacbac lib/forks/shared/attributes.pm | |
30 | SHA1 c3d1005210cd2e4d7bfa84049265502575e66919 lib/forks/shared/global_filter.pm | |
31 | SHA1 7854d750f050dfc7647a51c2089fe531dc9a403c lib/forks/signals.pm | |
32 | SHA1 a2086fe848ccd84429b6ea56e16a4089ae537e97 lib/threads/shared/array.pm | |
33 | SHA1 d551aa10adbc34a19feb657d98ff06c2151dae0c lib/threads/shared/handle.pm | |
34 | SHA1 90e06dddf521d4cd1d9f800b820f93d162e9db9e lib/threads/shared/hash.pm | |
35 | SHA1 9af7d904161a969ead1ee6ef165820e8b10c2e82 lib/threads/shared/scalar.pm | |
36 | SHA1 5663394514567cec7cb9537e7ce6682ffdd8e032 ppport.h | |
28 | SHA1 cd37d8f45b342580bbc71e3fae23f6e19422a1f0 lib/forks/shared.pm | |
29 | SHA1 bf8c9cdbe2db94440679408334384f0e37eafb16 lib/forks/shared/attributes.pm | |
30 | SHA1 2a5fb60f3e373fcb7bd3b0fa64c4627a5476e44b lib/forks/shared/global_filter.pm | |
31 | SHA1 0f5cb2beb12425351fd25a41ac3f3ba4eeba8b9b lib/forks/signals.pm | |
32 | SHA1 69323faf9b45991bfa344985ac1740ab0a5808c3 lib/threads/shared/array.pm | |
33 | SHA1 7612ccf657d6b8b5c2654210eb3b252d2ef9989a lib/threads/shared/handle.pm | |
34 | SHA1 5f98eb1924251406f2491c71c5e275688963f541 lib/threads/shared/hash.pm | |
35 | SHA1 3425ecf491a0c2b66b6785d0158ecd819cb1397d lib/threads/shared/scalar.pm | |
36 | SHA1 c0911c487a42e39c8541d2db1ddd5fd74c7c1986 ppport.h | |
37 | SHA1 f22bda39f483db8ddaafd61935c6723d4087a778 t/forks00-requirements.t | |
37 | 38 | SHA1 e0b161c71a2dba88fa7827c54ab597bf29ba2cdb t/forks00-sigtrap.t |
38 | 39 | SHA1 aa7a677571cc9789653d489bc7cab8fbc091773d t/forks01.t |
39 | 40 | SHA1 dc739710ac9c97c36f8e2cb77ae5af4aee2e8447 t/forks02.t |
42 | 43 | SHA1 5c172556a690f58812039b10a243376ec2b9d6e3 t/forks05.t |
43 | 44 | SHA1 50af07b5275498fd708b4fb2d0de5e28062b33fd t/forks06.t |
44 | 45 | SHA1 f8dd4f7c16f7ce96cde23f1953737468fa6bad7f t/forks07.t |
45 | SHA1 d8f2a6f3c54cb33e454026e0f4c4576e0ff65dfb t/forks08.t | |
46 | SHA1 4a5951b2c10bfd35e3281c07d4101fbe27779d02 t/forks08.t | |
46 | 47 | SHA1 b073b28bc806f47dabe93d69dd7e47dc7fe5ee6d t/forks09.t |
47 | 48 | SHA1 84f14953836fd57500007907d3a30e9813fdfca3 t/forks10.t |
48 | 49 | SHA1 d45ee162070db10b691958fa140d8fc297bd3d90 t/forks20.t |
50 | 51 | -----BEGIN PGP SIGNATURE----- |
51 | 52 | Version: GnuPG v1.4.8 (Darwin) |
52 | 53 | |
53 | iEYEARECAAYFAkncWl4ACgkQQwn7DcpJEO6znwCfc/hINJZS0wuIngd/oHJ1+l8u | |
54 | QpUAoIuKk6VMsLtupu0iKKMO8Q99aWtY | |
55 | =kjV9 | |
54 | iEYEARECAAYFAkwV0vQACgkQQwn7DcpJEO610gCfaCQkK6q7fn4BX61UnYlNVAhi | |
55 | IlcAn2jpfXo09widnviXvEBpf4Qxyxv1 | |
56 | =3geb | |
56 | 57 | -----END PGP SIGNATURE----- |
21 | 21 | Consider interfacing with graphical Perl debugger intefaces, to simplify |
22 | 22 | multi-threaded debugging; managing multiple TTYs, although supported in different |
23 | 23 | terminals (1 per thread), can be conceptually difficult. Considering interface |
24 | to Devel::PDB. Open to suggestions, comments, patches. | |
24 | to Devel::PDB. Consider support for Eclipse. Open to suggestions, comments, patches. | |
25 | 25 | |
26 | 26 | |
27 | 27 | ***** Issues to Address ***** |
94 | 94 | |
95 | 95 | |
96 | 96 | ***** Miscellaneous Items ***** |
97 | ||
98 | Update documentation to discuss fault-tolerance (individual thread can't take down the thread group, even with memory faults like segfault). Very helpful for high-availability systems. | |
97 | 99 | |
98 | 100 | Consider checking _check_pl_signal_unsafe_flag for any thread signaling behavior, |
99 | 101 | and warn user about (or prevent from using) signals (i.e. deadlock detect, $t->kill). |
403 | 403 | if (!SvROK(myref)) |
404 | 404 | Perl_croak(aTHX_ "Argument to _id needs to be passed as ref"); |
405 | 405 | myref = SvRV(myref); |
406 | if (SvMAGICAL(myref)) | |
407 | mg_get(myref); | |
406 | SvGETMAGIC(myref); | |
408 | 407 | if(SvROK(myref)) |
409 | 408 | myref = SvRV(myref); |
410 | 409 |
0 | 0 | package |
1 | 1 | forks::shared::attributes; #hide from PAUSE |
2 | $VERSION = '0.33'; | |
2 | $VERSION = '0.34'; | |
3 | 3 | |
4 | 4 | use Attribute::Handlers; |
5 | 5 |
9 | 9 | use List::MoreUtils; |
10 | 10 | |
11 | 11 | use vars '$VERSION'; |
12 | $VERSION = '0.33'; | |
12 | $VERSION = '0.34'; | |
13 | 13 | |
14 | 14 | our @FILTER = (); |
15 | 15 | my @_dummy = (*ARGVOUT); |
0 | 0 | package forks::shared; # make sure CPAN picks up on forks::shared.pm |
1 | $VERSION = '0.33'; | |
1 | $VERSION = '0.34'; | |
2 | 2 | |
3 | 3 | use Config (); |
4 | 4 | |
34 | 34 | # Do everything by the book from now on |
35 | 35 | |
36 | 36 | BEGIN { |
37 | $VERSION = '1.28'; | |
37 | $VERSION = '1.33'; | |
38 | 38 | $threads_shared = $threads_shared = 1; |
39 | 39 | } |
40 | 40 | use strict; |
1178 | 1178 | =head1 COPYRIGHT |
1179 | 1179 | |
1180 | 1180 | Copyright (c) |
1181 | 2005-2009 Eric Rybski <rybskej@yahoo.com>, | |
1181 | 2005-2010 Eric Rybski <rybskej@yahoo.com>, | |
1182 | 1182 | 2002-2004 Elizabeth Mattijsen <liz@dijkmat.nl>. |
1183 | 1183 | All rights reserved. This program is free software; you can redistribute it |
1184 | 1184 | and/or modify it under the same terms as Perl itself. |
0 | 0 | package |
1 | 1 | forks::signals; #hide from PAUSE |
2 | $VERSION = '0.33'; | |
2 | $VERSION = '0.34'; | |
3 | 3 | |
4 | 4 | use strict; |
5 | 5 | use warnings; |
176 | 176 | =head1 COPYRIGHT |
177 | 177 | |
178 | 178 | Copyright (c) |
179 | 2005-2009 Eric Rybski <rybskej@yahoo.com>. | |
179 | 2005-2010 Eric Rybski <rybskej@yahoo.com>. | |
180 | 180 | All rights reserved. This program is free software; you can redistribute it |
181 | 181 | and/or modify it under the same terms as Perl itself. |
182 | 182 |
0 | 0 | package forks; # make sure CPAN picks up on forks.pm |
1 | $VERSION = '0.33'; | |
1 | $VERSION = '0.34'; | |
2 | 2 | |
3 | 3 | # Allow external modules to defer shared variable init at require |
4 | 4 | |
14 | 14 | # Be strict from now on |
15 | 15 | |
16 | 16 | BEGIN { |
17 | $VERSION = '1.72'; | |
17 | $VERSION = '1.77'; | |
18 | 18 | $threads = $threads = 1; # twice to avoid warnings |
19 | 19 | $forks::threads = $forks::threads = 1; # twice to avoid warnings |
20 | 20 | $forks::threads_override = $forks::threads_override = 0; # twice to avoid warnings |
107 | 107 | |
108 | 108 | use constant EXIT_THREAD_ONLY => 'thread_only'; |
109 | 109 | use constant EXIT_THREADS_ONLY => 'threads_only'; |
110 | ||
111 | # (bug?) Perl 5.11+ each function may not correctly set hash iterator when using refs as keys | |
112 | use constant RESET_EACH_ITER => $] >= 5.011; | |
110 | 113 | |
111 | 114 | #--------------------------------------------------------------------------- |
112 | 115 | # Modify Perl's Config.pm to simulate that it was built with ithreads |
245 | 248 | # Initialize thread local hash (key: pid) whether this process is a thread |
246 | 249 | # Initialize local flag whether main thread received ABRT signal |
247 | 250 | # Initialize local flag whether main thread exited due to ABRT signal |
251 | # Initialize local flag whether main thread should be signalled with ABRT on server shutdown | |
248 | 252 | # Initialize hash (key: pid) of child thread PIDs |
249 | 253 | # Thread local flag whether we're shutting down |
250 | 254 | # Thread local flag whether we're shutting down in END block |
258 | 262 | my %ISATHREAD; |
259 | 263 | my $MAIN_ABRT_HANDLED = 0; |
260 | 264 | my $MAIN_EXIT_WITH_ABRT = 0; |
265 | my $MAIN_EXIT_NO_ABRT = 0; | |
261 | 266 | my %CHILD_PID; |
262 | 267 | my $SHUTTING_DOWN = 0; |
263 | 268 | my $SHUTTING_DOWN_END = 0; |
630 | 635 | *Time::HiRes::sleep = *Time::HiRes::sleep = $sub; |
631 | 636 | |
632 | 637 | if (&Time::HiRes::d_usleep |
633 | && defined(my $t = eval { Time::HiRes::nanosleep(0) }) && !$@) { | |
638 | && defined(my $t = eval { Time::HiRes::usleep(0) }) && !$@) { | |
634 | 639 | $proto = prototype 'Time::HiRes::usleep'; |
635 | 640 | my $usleep = \&Time::HiRes::usleep; |
636 | 641 | $sub = sub { |
1490 | 1495 | } |
1491 | 1496 | CORE::kill('SIGKILL', $_) foreach @pidtokill; |
1492 | 1497 | CORE::kill('SIGABRT', $PID_MAIN_THREAD) |
1493 | if CORE::kill(0, $PID_MAIN_THREAD); | |
1498 | if !$MAIN_EXIT_NO_ABRT && CORE::kill(0, $PID_MAIN_THREAD); | |
1494 | 1499 | |
1495 | 1500 | $QUERY->shutdown(2) if defined $QUERY; |
1496 | 1501 | unlink($PORT) if $THREADS_UNIX && -S $PORT; |
1581 | 1586 | my $clients = keys %WRITE; |
1582 | 1587 | _log( " ! $clients>>" ) if $clients; |
1583 | 1588 | } |
1589 | keys %WRITE if RESET_EACH_ITER; | |
1584 | 1590 | my $write = (each %WRITE) || ''; |
1585 | 1591 | _update_timedwaiting_idx(); |
1586 | 1592 | $curtime = time(); |
1665 | 1671 | # If we have read something already |
1666 | 1672 | # If we have all we're expecting |
1667 | 1673 | |
1674 | keys %read if RESET_EACH_ITER; | |
1668 | 1675 | while (my $client = each %read) { |
1669 | 1676 | if (my $read = length( $read{$client} )) { |
1670 | 1677 | if ($read == $toread{$client}) { |
1803 | 1810 | # Reloop if there is still stuff to send there |
1804 | 1811 | # Make sure we won't check this client again |
1805 | 1812 | |
1813 | keys %DONEWITH if RESET_EACH_ITER; | |
1806 | 1814 | while (my $client = each %DONEWITH) { |
1807 | 1815 | next if $RUNNING && exists( $WRITE{$client} ); |
1808 | 1816 | _log( " !$CLIENT2TID{$client} shutting down" ) if DEBUG; |
1812 | 1820 | # Obtain the client object (rather than its stringification) |
1813 | 1821 | # Remove the client from polling loop |
1814 | 1822 | # Properly close the client from this end |
1815 | # Mark server to shutdown if we were waiting for this client to exit | |
1823 | # If we were waiting for this client to exit | |
1824 | # Mark that main thread should not be ABRT signalled, if main thread is shutting down | |
1825 | # Mark server to shutdown | |
1816 | 1826 | |
1817 | 1827 | my $tid = $CLIENT2TID{$client}; |
1818 | 1828 | $client = $TID2CLIENT{$tid}; |
1819 | 1829 | $select->remove( $client ); |
1820 | 1830 | close( $client ); |
1821 | $RUNNING = 0 if $RUNNING eq $client; | |
1831 | if ($RUNNING eq $client) { | |
1832 | $MAIN_EXIT_NO_ABRT = 1 if $tid == 0; | |
1833 | $RUNNING = 0; | |
1834 | } | |
1822 | 1835 | |
1823 | 1836 | # Do the clean up |
1824 | 1837 | |
3426 | 3439 | # Try removing TID from %TIMEDWAITING |
3427 | 3440 | # Delete any messages that might have been pending for this client |
3428 | 3441 | # Else (it's the main thread shutting down and main thread is parent process) |
3429 | # Reset running flag | |
3442 | # Update running flag for pending server shutdown | |
3430 | 3443 | # Mark this client for deletion |
3431 | 3444 | # Send result to thread to allow it to shut down |
3432 | 3445 | |
3463 | 3476 | } |
3464 | 3477 | } |
3465 | 3478 | } elsif ($THREADS_INTEGRATED_MODEL) { |
3466 | $RUNNING = 0; | |
3479 | $RUNNING = $client; | |
3467 | 3480 | } |
3468 | 3481 | $DONEWITH{$client} = undef; |
3469 | 3482 | $WRITE{$client} = $true; #TODO: make sure socket is still alive, otherwise could cause server to croak on dead socket (need to protect server with correct error state--EPIPE?) |
3739 | 3752 | |
3740 | 3753 | #--------------------------------------------------------------------------- |
3741 | 3754 | |
3755 | package | |
3756 | forks::shared::_preload; # Preload forks::shared for seamless 'require threads::shared' | |
3757 | ||
3758 | require forks::shared | |
3759 | unless exists( $ENV{'THREADS_NO_PRELOAD_SHARED'} ) && $ENV{'THREADS_NO_PRELOAD_SHARED'}; | |
3760 | ||
3761 | #--------------------------------------------------------------------------- | |
3762 | ||
3742 | 3763 | # Satisfy -require- |
3743 | 3764 | |
3744 | 3765 | 1; |
3752 | 3773 | |
3753 | 3774 | =head1 VERSION |
3754 | 3775 | |
3755 | This documentation describes version 0.33. | |
3776 | This documentation describes version 0.34. | |
3756 | 3777 | |
3757 | 3778 | =head1 SYNOPSIS |
3758 | 3779 | |
3810 | 3831 | } |
3811 | 3832 | |
3812 | 3833 | # Use forks as a drop-in replacement for an ithreads application |
3813 | perl -Mforks -Mforks::shared threadapplication | |
3834 | perl -Mforks threadapplication | |
3814 | 3835 | |
3815 | 3836 | See L<threads/"SYNOPSIS"> for more examples. |
3816 | 3837 | |
3844 | 3865 | Since forks overrides core Perl functions, you are *strongly* encouraged to |
3845 | 3866 | load the forks module before any other Perl modules. This will insure the |
3846 | 3867 | most consistent and stable system behavior. This can be easily done without |
3847 | affecting existing code, like the following examples: | |
3868 | affecting existing code, like: | |
3848 | 3869 | |
3849 | 3870 | perl -Mforks script.pl |
3850 | perl -Mforks -Mforks::shared script.pl | |
3851 | 3871 | |
3852 | 3872 | =head2 memory usage |
3853 | 3873 | |
4113 | 4133 | thraad group state. This feature is switched on by defining the environment |
4114 | 4134 | variable C<THREADS_DAEMON_MODEL>. An example use might be: |
4115 | 4135 | |
4116 | THREADS_DAEMON_MODEL=1 perl -Mforks -Mforks::shared -MPOE threadapplication | |
4136 | THREADS_DAEMON_MODEL=1 perl -Mforks -MPOE threadapplication | |
4117 | 4137 | |
4118 | 4138 | This function essentially reverses the parent-child relationship between the |
4119 | 4139 | main thread and the thread state process that forks.pm uses. Extra care has |
4367 | 4387 | =head1 COPYRIGHT |
4368 | 4388 | |
4369 | 4389 | Copyright (c) |
4370 | 2005-2009 Eric Rybski <rybskej@yahoo.com>, | |
4390 | 2005-2010 Eric Rybski <rybskej@yahoo.com>, | |
4371 | 4391 | 2002-2004 Elizabeth Mattijsen <liz@dijkmat.nl>. |
4372 | 4392 | All rights reserved. This program is free software; you can redistribute it |
4373 | 4393 | and/or modify it under the same terms as Perl itself. |
2 | 2 | # Make sure we have version info for this module |
3 | 3 | # Make sure we do everything by the book from now on |
4 | 4 | |
5 | $VERSION = '0.33'; | |
5 | $VERSION = '0.34'; | |
6 | 6 | use strict; |
7 | 7 | use Scalar::Util; |
8 | 8 | |
144 | 144 | =head1 COPYRIGHT |
145 | 145 | |
146 | 146 | Copyright (c) |
147 | 2005-2009 Eric Rybski <rybskej@yahoo.com>, | |
147 | 2005-2010 Eric Rybski <rybskej@yahoo.com>, | |
148 | 148 | 2002-2004 Elizabeth Mattijsen <liz@dijkmat.nl>. |
149 | 149 | All rights reserved. This program is free software; you can redistribute it |
150 | 150 | and/or modify it under the same terms as Perl itself. |
2 | 2 | # Make sure we have version info for this module |
3 | 3 | # Make sure we do everything by the book from now on |
4 | 4 | |
5 | $VERSION = '0.33'; | |
5 | $VERSION = '0.34'; | |
6 | 6 | use strict; |
7 | 7 | |
8 | 8 | # Satisfy -require- |
174 | 174 | =head1 COPYRIGHT |
175 | 175 | |
176 | 176 | Copyright (c) |
177 | 2005-2009 Eric Rybski <rybskej@yahoo.com>, | |
177 | 2005-2010 Eric Rybski <rybskej@yahoo.com>, | |
178 | 178 | 2002-2004 Elizabeth Mattijsen <liz@dijkmat.nl>. |
179 | 179 | All rights reserved. This program is free software; you can redistribute it |
180 | 180 | and/or modify it under the same terms as Perl itself. |
2 | 2 | # Make sure we have version info for this module |
3 | 3 | # Make sure we do everything by the book from now on |
4 | 4 | |
5 | $VERSION = '0.33'; | |
5 | $VERSION = '0.34'; | |
6 | 6 | use strict; |
7 | 7 | use Scalar::Util; |
8 | 8 | |
101 | 101 | =head1 COPYRIGHT |
102 | 102 | |
103 | 103 | Copyright (c) |
104 | 2005-2009 Eric Rybski <rybskej@yahoo.com>, | |
104 | 2005-2010 Eric Rybski <rybskej@yahoo.com>, | |
105 | 105 | 2002-2004 Elizabeth Mattijsen <liz@dijkmat.nl>. |
106 | 106 | All rights reserved. This program is free software; you can redistribute it |
107 | 107 | and/or modify it under the same terms as Perl itself. |
2 | 2 | # Make sure we have version info for this module |
3 | 3 | # Make sure we do everything by the book from now on |
4 | 4 | |
5 | $VERSION = '0.33'; | |
5 | $VERSION = '0.34'; | |
6 | 6 | use strict; |
7 | 7 | use Scalar::Util; |
8 | 8 | |
68 | 68 | =head1 COPYRIGHT |
69 | 69 | |
70 | 70 | Copyright (c) |
71 | 2005-2009 Eric Rybski <rybskej@yahoo.com>, | |
71 | 2005-2010 Eric Rybski <rybskej@yahoo.com>, | |
72 | 72 | 2002-2004 Elizabeth Mattijsen <liz@dijkmat.nl>. |
73 | 73 | All rights reserved. This program is free software; you can redistribute it |
74 | 74 | and/or modify it under the same terms as Perl itself. |
3 | 3 | /* |
4 | 4 | ---------------------------------------------------------------------- |
5 | 5 | |
6 | ppport.h -- Perl/Pollution/Portability Version 3.16 | |
6 | ppport.h -- Perl/Pollution/Portability Version 3.19 | |
7 | 7 | |
8 | 8 | Automatically created by Devel::PPPort running under perl 5.008008. |
9 | 9 | |
22 | 22 | if (@ARGV && $ARGV[0] eq '--unstrip') { |
23 | 23 | eval { require Devel::PPPort }; |
24 | 24 | $@ and die "Cannot require Devel::PPPort, please install.\n"; |
25 | if (eval $Devel::PPPort::VERSION < 3.16) { | |
26 | die "ppport.h was originally generated with Devel::PPPort 3.16.\n" | |
25 | if (eval $Devel::PPPort::VERSION < 3.19) { | |
26 | die "ppport.h was originally generated with Devel::PPPort 3.19.\n" | |
27 | 27 | . "Your Devel::PPPort is only version $Devel::PPPort::VERSION.\n" |
28 | 28 | . "Please install a newer version, or --unstrip will not work.\n"; |
29 | 29 | } |
544 | 544 | #endif |
545 | 545 | #define INT2PTR(any,d) (any)(PTRV)(d) |
546 | 546 | #endif |
547 | #define NUM2PTR(any,d) (any)(PTRV)(d) | |
548 | #define PTR2IV(p) INT2PTR(IV,p) | |
549 | #define PTR2UV(p) INT2PTR(UV,p) | |
550 | #define PTR2NV(p) NUM2PTR(NV,p) | |
547 | #endif | |
548 | #ifndef PTR2ul | |
551 | 549 | #if PTRSIZE == LONGSIZE |
552 | 550 | #define PTR2ul(p) (unsigned long)(p) |
553 | 551 | #else |
554 | 552 | #define PTR2ul(p) INT2PTR(unsigned long,p) |
555 | 553 | #endif |
554 | #endif | |
555 | #ifndef PTR2nat | |
556 | #define PTR2nat(p) (PTRV)(p) | |
557 | #endif | |
558 | #ifndef NUM2PTR | |
559 | #define NUM2PTR(any,d) (any)PTR2nat(d) | |
560 | #endif | |
561 | #ifndef PTR2IV | |
562 | #define PTR2IV(p) INT2PTR(IV,p) | |
563 | #endif | |
564 | #ifndef PTR2UV | |
565 | #define PTR2UV(p) INT2PTR(UV,p) | |
566 | #endif | |
567 | #ifndef PTR2NV | |
568 | #define PTR2NV(p) NUM2PTR(NV,p) | |
556 | 569 | #endif |
557 | 570 | #undef START_EXTERN_C |
558 | 571 | #undef END_EXTERN_C |
652 | 665 | PL_stack_sp = PL_stack_base + ax + ((off) - 1); \ |
653 | 666 | return; \ |
654 | 667 | } STMT_END |
668 | #endif | |
669 | #ifndef XSPROTO | |
670 | #define XSPROTO(name) void name(pTHX_ CV* cv) | |
671 | #endif | |
672 | #ifndef SVfARG | |
673 | #define SVfARG(p) ((void*)(p)) | |
655 | 674 | #endif |
656 | 675 | #ifndef PERL_ABS |
657 | 676 | #define PERL_ABS(x) ((x) < 0 ? -(x) : (x)) |
788 | 807 | #define PL_dirty dirty |
789 | 808 | #define PL_dowarn dowarn |
790 | 809 | #define PL_errgv errgv |
810 | #define PL_error_count error_count | |
791 | 811 | #define PL_expect expect |
792 | 812 | #define PL_hexdigit hexdigit |
793 | 813 | #define PL_hints hints |
814 | #define PL_in_my in_my | |
794 | 815 | #define PL_laststatval laststatval |
795 | 816 | #define PL_lex_state lex_state |
796 | 817 | #define PL_lex_stuff lex_stuff |
844 | 865 | #define PL_lex_state D_PPP_my_PL_parser_var(lex_state) |
845 | 866 | #define PL_lex_stuff D_PPP_my_PL_parser_var(lex_stuff) |
846 | 867 | #define PL_tokenbuf D_PPP_my_PL_parser_var(tokenbuf) |
868 | #define PL_in_my D_PPP_my_PL_parser_var(in_my) | |
869 | #define PL_in_my_stash D_PPP_my_PL_parser_var(in_my_stash) | |
870 | #define PL_error_count D_PPP_my_PL_parser_var(error_count) | |
847 | 871 | #else |
848 | 872 | #define PL_parser ((void *) 1) |
849 | 873 | #endif |
1250 | 1274 | #ifndef SvREFCNT_inc_simple_void_NN |
1251 | 1275 | #define SvREFCNT_inc_simple_void_NN(sv) (void)(++SvREFCNT((SV*)(sv))) |
1252 | 1276 | #endif |
1277 | #ifndef newSV_type | |
1278 | #if defined(NEED_newSV_type) | |
1279 | static SV* DPPP_(my_newSV_type)(pTHX_ svtype const t); | |
1280 | static | |
1281 | #else | |
1282 | extern SV* DPPP_(my_newSV_type)(pTHX_ svtype const t); | |
1283 | #endif | |
1284 | #ifdef newSV_type | |
1285 | #undef newSV_type | |
1286 | #endif | |
1287 | #define newSV_type(a) DPPP_(my_newSV_type)(aTHX_ a) | |
1288 | #define Perl_newSV_type DPPP_(my_newSV_type) | |
1289 | #if defined(NEED_newSV_type) || defined(NEED_newSV_type_GLOBAL) | |
1290 | SV* | |
1291 | DPPP_(my_newSV_type)(pTHX_ svtype const t) | |
1292 | { | |
1293 | SV* const sv = newSV(0); | |
1294 | sv_upgrade(sv, t); | |
1295 | return sv; | |
1296 | } | |
1297 | #endif | |
1298 | #endif | |
1253 | 1299 | #if (PERL_BCDVERSION < 0x5006000) |
1254 | 1300 | #define D_PPP_CONSTPV_ARG(x) ((char *) (x)) |
1255 | 1301 | #else |
1715 | 1761 | #ifndef SvSHARED_HASH |
1716 | 1762 | #define SvSHARED_HASH(sv) (0 + SvUVX(sv)) |
1717 | 1763 | #endif |
1764 | #ifndef HvNAME_get | |
1765 | #define HvNAME_get(hv) HvNAME(hv) | |
1766 | #endif | |
1767 | #ifndef HvNAMELEN_get | |
1768 | #define HvNAMELEN_get(hv) (HvNAME_get(hv) ? (I32)strlen(HvNAME_get(hv)) : 0) | |
1769 | #endif | |
1770 | #ifndef GvSVn | |
1771 | #define GvSVn(gv) GvSV(gv) | |
1772 | #endif | |
1773 | #ifndef isGV_with_GP | |
1774 | #define isGV_with_GP(gv) isGV(gv) | |
1775 | #endif | |
1718 | 1776 | #ifndef WARN_ALL |
1719 | 1777 | #define WARN_ALL 0 |
1720 | 1778 | #endif |
1911 | 1969 | #endif |
1912 | 1970 | #ifndef hv_stores |
1913 | 1971 | #define hv_stores(hv, key, val) hv_store(hv, key "", sizeof(key) - 1, val, 0) |
1972 | #endif | |
1973 | #ifndef gv_fetchpvn_flags | |
1974 | #define gv_fetchpvn_flags(name, len, flags, svt) gv_fetchpv(name, flags, svt) | |
1975 | #endif | |
1976 | #ifndef gv_fetchpvs | |
1977 | #define gv_fetchpvs(name, flags, svt) gv_fetchpvn_flags(name "", sizeof(name) - 1, flags, svt) | |
1978 | #endif | |
1979 | #ifndef gv_stashpvs | |
1980 | #define gv_stashpvs(name, flags) gv_stashpvn(name "", sizeof(name) - 1, flags) | |
1914 | 1981 | #endif |
1915 | 1982 | #ifndef SvGETMAGIC |
1916 | 1983 | #define SvGETMAGIC(x) STMT_START { if (SvGMAGICAL(x)) mg_get(x); } STMT_END |
0 | #!/usr/local/bin/perl -w | |
1 | BEGIN { | |
2 | if ($ENV{PERL_CORE}) { | |
3 | chdir 't' if -d 't'; | |
4 | @INC = '../lib'; | |
5 | } elsif (!grep /blib/, @INC) { | |
6 | chdir 't' if -d 't'; | |
7 | unshift @INC, ('../blib/lib', '../blib/arch'); | |
8 | } | |
9 | } | |
10 | ||
11 | BEGIN {delete $ENV{THREADS_DEBUG}} # no debugging during testing! | |
12 | ||
13 | use Test::More tests => 7; | |
14 | ||
15 | use Scalar::Util; | |
16 | use File::Spec; | |
17 | use Acme::Damn (); | |
18 | use Storable (); | |
19 | use List::MoreUtils; | |
20 | use Sys::SigAction; | |
21 | ||
22 | ok(!(grep { /set_prototype/ } @Scalar::Util::EXPORT_FAIL), "Scalar::Util appears to have been compiled without XS features: set_prototype. Try rebuilding Scalar::Util package with `perl Makefile.PL -xs`"); | |
23 | can_ok( 'Scalar::Util',qw(set_prototype reftype blessed refaddr weaken) ); | |
24 | can_ok( 'File::Spec',qw(tmpdir) ); | |
25 | can_ok( 'Acme::Damn',qw(damn) ); | |
26 | can_ok( 'Storable',qw(freeze thaw) ); | |
27 | can_ok( 'List::MoreUtils',qw(firstidx minmax uniq) ); | |
28 | can_ok( 'Sys::SigAction', qw(set_sig_handler) ); |
71 | 71 | |
72 | 72 | # Check that main thread waits full 5 seconds after CHLD signal |
73 | 73 | SKIP: { |
74 | skip('usleep not supported on this platform',1) unless &Time::HiRes::d_usleep && defined(my $t = eval { &Time::HiRes::usleep(0) }) && !$@; | |
74 | skip('usleep not supported on this platform',2) unless &Time::HiRes::d_usleep && defined(my $t = eval { &Time::HiRes::usleep(0) }) && !$@; | |
75 | 75 | $t1 = threads->new(sub { sleep 1; }); |
76 | 76 | $time = &Time::HiRes::usleep(5000000); |
77 | 77 | $t1->join(); |
82 | 82 | |
83 | 83 | # Check that main thread waits full 5 seconds after CHLD signal |
84 | 84 | SKIP: { |
85 | skip('Time::HiRes::nanosleep function not supported on this platform',1) | |
85 | skip('Time::HiRes::nanosleep function not supported on this platform',2) | |
86 | 86 | unless &Time::HiRes::d_nanosleep && defined(my $t = eval { &Time::HiRes::nanosleep(0) }) && !$@; |
87 | 87 | $t1 = threads->new(sub { sleep 1; }); |
88 | 88 | $time = &Time::HiRes::nanosleep(5000000000); |