Codebase list libforks-perl / 17e703d
[svn-upgrade] new version libforks-perl (0.34) Salvatore Bonaccorso 13 years ago
19 changed file(s) with 214 addition(s) and 64 deletion(s). Raw diff Collapse all Expand all
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
029 0.33 April 8 2009
130 ***** Bug fixes *****
231
1717 ppport.h
1818 README
1919 SIGNATURE
20 t/forks00-requirements.t
2021 t/forks00-sigtrap.t
2122 t/forks01.t
2223 t/forks02.t
00 --- #YAML:1.0
11 name: forks
2 version: 0.33
2 version: 0.34
33 abstract: forks - emulate threads with fork
44 author:
55 - Eric Rybski (rybskej@yahoo.com)
66 license: unknown
77 distribution_type: module
88 configure_requires:
9 ExtUtils::MakeMaker: 0
10 build_requires:
911 ExtUtils::MakeMaker: 0
1012 requires:
1113 Acme::Damn: 0
2426 directory:
2527 - t
2628 - inc
27 generated_by: ExtUtils::MakeMaker version 6.48
29 generated_by: ExtUtils::MakeMaker version 6.56
2830 meta-spec:
2931 url: http://module-build.sourceforge.net/META-spec-v1.4.html
3032 version: 1.4
00 README for forks
11
22 Version:
3 0.33
3 0.34
44
55 The forks.pm module is a drop-in replacement for threads.pm. It has the
66 same syntax as the threads.pm module (it even takes over its namespace) but
1313 -----BEGIN PGP SIGNED MESSAGE-----
1414 Hash: SHA1
1515
16 SHA1 d6fdbd833e0407ed07fe57dd6d697b57f8b84664 CHANGELOG
16 SHA1 caf1c6cc98552b9d6d7fc024f3bcd3019497d5bd CHANGELOG
1717 SHA1 455b7ebe2265a00e97f133c8cd7ebf56148a573d CREDITS
18 SHA1 c918d4ed8f1acf452740801a33f6885e2c47d28e MANIFEST
18 SHA1 3b891564aac2c35b5016ba3c6a5d0dfa67b78a62 MANIFEST
1919 SHA1 0a40de91b5f4169eef3ff3ef456a40b79d056e78 MANIFEST.skip
20 SHA1 696fbeb7ffb81e169e77edc28072e005cf54b288 META.yml
20 SHA1 e65dfda52c048de13ac9f1c051cc3cbe585e8402 META.yml
2121 SHA1 24f37b818f36c8c93acf447c05dbb3804a9368ae Makefile.PL
22 SHA1 f7d6225860423f7dd7a81c18828dd2cdf2bfb5f3 README
23 SHA1 10357d353c270dcdad97a24923845201778e97f7 TODO
22 SHA1 e75a558d750f60a93c86932192fe982b0d410281 README
23 SHA1 a4ab922a5133b93496f3e5f037b7f9b4684b7555 TODO
2424 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
2727 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
3738 SHA1 e0b161c71a2dba88fa7827c54ab597bf29ba2cdb t/forks00-sigtrap.t
3839 SHA1 aa7a677571cc9789653d489bc7cab8fbc091773d t/forks01.t
3940 SHA1 dc739710ac9c97c36f8e2cb77ae5af4aee2e8447 t/forks02.t
4243 SHA1 5c172556a690f58812039b10a243376ec2b9d6e3 t/forks05.t
4344 SHA1 50af07b5275498fd708b4fb2d0de5e28062b33fd t/forks06.t
4445 SHA1 f8dd4f7c16f7ce96cde23f1953737468fa6bad7f t/forks07.t
45 SHA1 d8f2a6f3c54cb33e454026e0f4c4576e0ff65dfb t/forks08.t
46 SHA1 4a5951b2c10bfd35e3281c07d4101fbe27779d02 t/forks08.t
4647 SHA1 b073b28bc806f47dabe93d69dd7e47dc7fe5ee6d t/forks09.t
4748 SHA1 84f14953836fd57500007907d3a30e9813fdfca3 t/forks10.t
4849 SHA1 d45ee162070db10b691958fa140d8fc297bd3d90 t/forks20.t
5051 -----BEGIN PGP SIGNATURE-----
5152 Version: GnuPG v1.4.8 (Darwin)
5253
53 iEYEARECAAYFAkncWl4ACgkQQwn7DcpJEO6znwCfc/hINJZS0wuIngd/oHJ1+l8u
54 QpUAoIuKk6VMsLtupu0iKKMO8Q99aWtY
55 =kjV9
54 iEYEARECAAYFAkwV0vQACgkQQwn7DcpJEO610gCfaCQkK6q7fn4BX61UnYlNVAhi
55 IlcAn2jpfXo09widnviXvEBpf4Qxyxv1
56 =3geb
5657 -----END PGP SIGNATURE-----
2121 Consider interfacing with graphical Perl debugger intefaces, to simplify
2222 multi-threaded debugging; managing multiple TTYs, although supported in different
2323 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.
2525
2626
2727 ***** Issues to Address *****
9494
9595
9696 ***** 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.
9799
98100 Consider checking _check_pl_signal_unsafe_flag for any thread signaling behavior,
99101 and warn user about (or prevent from using) signals (i.e. deadlock detect, $t->kill).
403403 if (!SvROK(myref))
404404 Perl_croak(aTHX_ "Argument to _id needs to be passed as ref");
405405 myref = SvRV(myref);
406 if (SvMAGICAL(myref))
407 mg_get(myref);
406 SvGETMAGIC(myref);
408407 if(SvROK(myref))
409408 myref = SvRV(myref);
410409
00 package
11 forks::shared::attributes; #hide from PAUSE
2 $VERSION = '0.33';
2 $VERSION = '0.34';
33
44 use Attribute::Handlers;
55
99 use List::MoreUtils;
1010
1111 use vars '$VERSION';
12 $VERSION = '0.33';
12 $VERSION = '0.34';
1313
1414 our @FILTER = ();
1515 my @_dummy = (*ARGVOUT);
00 package forks::shared; # make sure CPAN picks up on forks::shared.pm
1 $VERSION = '0.33';
1 $VERSION = '0.34';
22
33 use Config ();
44
3434 # Do everything by the book from now on
3535
3636 BEGIN {
37 $VERSION = '1.28';
37 $VERSION = '1.33';
3838 $threads_shared = $threads_shared = 1;
3939 }
4040 use strict;
11781178 =head1 COPYRIGHT
11791179
11801180 Copyright (c)
1181 2005-2009 Eric Rybski <rybskej@yahoo.com>,
1181 2005-2010 Eric Rybski <rybskej@yahoo.com>,
11821182 2002-2004 Elizabeth Mattijsen <liz@dijkmat.nl>.
11831183 All rights reserved. This program is free software; you can redistribute it
11841184 and/or modify it under the same terms as Perl itself.
00 package
11 forks::signals; #hide from PAUSE
2 $VERSION = '0.33';
2 $VERSION = '0.34';
33
44 use strict;
55 use warnings;
176176 =head1 COPYRIGHT
177177
178178 Copyright (c)
179 2005-2009 Eric Rybski <rybskej@yahoo.com>.
179 2005-2010 Eric Rybski <rybskej@yahoo.com>.
180180 All rights reserved. This program is free software; you can redistribute it
181181 and/or modify it under the same terms as Perl itself.
182182
00 package forks; # make sure CPAN picks up on forks.pm
1 $VERSION = '0.33';
1 $VERSION = '0.34';
22
33 # Allow external modules to defer shared variable init at require
44
1414 # Be strict from now on
1515
1616 BEGIN {
17 $VERSION = '1.72';
17 $VERSION = '1.77';
1818 $threads = $threads = 1; # twice to avoid warnings
1919 $forks::threads = $forks::threads = 1; # twice to avoid warnings
2020 $forks::threads_override = $forks::threads_override = 0; # twice to avoid warnings
107107
108108 use constant EXIT_THREAD_ONLY => 'thread_only';
109109 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;
110113
111114 #---------------------------------------------------------------------------
112115 # Modify Perl's Config.pm to simulate that it was built with ithreads
245248 # Initialize thread local hash (key: pid) whether this process is a thread
246249 # Initialize local flag whether main thread received ABRT signal
247250 # 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
248252 # Initialize hash (key: pid) of child thread PIDs
249253 # Thread local flag whether we're shutting down
250254 # Thread local flag whether we're shutting down in END block
258262 my %ISATHREAD;
259263 my $MAIN_ABRT_HANDLED = 0;
260264 my $MAIN_EXIT_WITH_ABRT = 0;
265 my $MAIN_EXIT_NO_ABRT = 0;
261266 my %CHILD_PID;
262267 my $SHUTTING_DOWN = 0;
263268 my $SHUTTING_DOWN_END = 0;
630635 *Time::HiRes::sleep = *Time::HiRes::sleep = $sub;
631636
632637 if (&Time::HiRes::d_usleep
633 && defined(my $t = eval { Time::HiRes::nanosleep(0) }) && !$@) {
638 && defined(my $t = eval { Time::HiRes::usleep(0) }) && !$@) {
634639 $proto = prototype 'Time::HiRes::usleep';
635640 my $usleep = \&Time::HiRes::usleep;
636641 $sub = sub {
14901495 }
14911496 CORE::kill('SIGKILL', $_) foreach @pidtokill;
14921497 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);
14941499
14951500 $QUERY->shutdown(2) if defined $QUERY;
14961501 unlink($PORT) if $THREADS_UNIX && -S $PORT;
15811586 my $clients = keys %WRITE;
15821587 _log( " ! $clients>>" ) if $clients;
15831588 }
1589 keys %WRITE if RESET_EACH_ITER;
15841590 my $write = (each %WRITE) || '';
15851591 _update_timedwaiting_idx();
15861592 $curtime = time();
16651671 # If we have read something already
16661672 # If we have all we're expecting
16671673
1674 keys %read if RESET_EACH_ITER;
16681675 while (my $client = each %read) {
16691676 if (my $read = length( $read{$client} )) {
16701677 if ($read == $toread{$client}) {
18031810 # Reloop if there is still stuff to send there
18041811 # Make sure we won't check this client again
18051812
1813 keys %DONEWITH if RESET_EACH_ITER;
18061814 while (my $client = each %DONEWITH) {
18071815 next if $RUNNING && exists( $WRITE{$client} );
18081816 _log( " !$CLIENT2TID{$client} shutting down" ) if DEBUG;
18121820 # Obtain the client object (rather than its stringification)
18131821 # Remove the client from polling loop
18141822 # 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
18161826
18171827 my $tid = $CLIENT2TID{$client};
18181828 $client = $TID2CLIENT{$tid};
18191829 $select->remove( $client );
18201830 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 }
18221835
18231836 # Do the clean up
18241837
34263439 # Try removing TID from %TIMEDWAITING
34273440 # Delete any messages that might have been pending for this client
34283441 # 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
34303443 # Mark this client for deletion
34313444 # Send result to thread to allow it to shut down
34323445
34633476 }
34643477 }
34653478 } elsif ($THREADS_INTEGRATED_MODEL) {
3466 $RUNNING = 0;
3479 $RUNNING = $client;
34673480 }
34683481 $DONEWITH{$client} = undef;
34693482 $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?)
37393752
37403753 #---------------------------------------------------------------------------
37413754
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
37423763 # Satisfy -require-
37433764
37443765 1;
37523773
37533774 =head1 VERSION
37543775
3755 This documentation describes version 0.33.
3776 This documentation describes version 0.34.
37563777
37573778 =head1 SYNOPSIS
37583779
38103831 }
38113832
38123833 # Use forks as a drop-in replacement for an ithreads application
3813 perl -Mforks -Mforks::shared threadapplication
3834 perl -Mforks threadapplication
38143835
38153836 See L<threads/"SYNOPSIS"> for more examples.
38163837
38443865 Since forks overrides core Perl functions, you are *strongly* encouraged to
38453866 load the forks module before any other Perl modules. This will insure the
38463867 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:
38483869
38493870 perl -Mforks script.pl
3850 perl -Mforks -Mforks::shared script.pl
38513871
38523872 =head2 memory usage
38533873
41134133 thraad group state. This feature is switched on by defining the environment
41144134 variable C<THREADS_DAEMON_MODEL>. An example use might be:
41154135
4116 THREADS_DAEMON_MODEL=1 perl -Mforks -Mforks::shared -MPOE threadapplication
4136 THREADS_DAEMON_MODEL=1 perl -Mforks -MPOE threadapplication
41174137
41184138 This function essentially reverses the parent-child relationship between the
41194139 main thread and the thread state process that forks.pm uses. Extra care has
43674387 =head1 COPYRIGHT
43684388
43694389 Copyright (c)
4370 2005-2009 Eric Rybski <rybskej@yahoo.com>,
4390 2005-2010 Eric Rybski <rybskej@yahoo.com>,
43714391 2002-2004 Elizabeth Mattijsen <liz@dijkmat.nl>.
43724392 All rights reserved. This program is free software; you can redistribute it
43734393 and/or modify it under the same terms as Perl itself.
22 # Make sure we have version info for this module
33 # Make sure we do everything by the book from now on
44
5 $VERSION = '0.33';
5 $VERSION = '0.34';
66 use strict;
77 use Scalar::Util;
88
144144 =head1 COPYRIGHT
145145
146146 Copyright (c)
147 2005-2009 Eric Rybski <rybskej@yahoo.com>,
147 2005-2010 Eric Rybski <rybskej@yahoo.com>,
148148 2002-2004 Elizabeth Mattijsen <liz@dijkmat.nl>.
149149 All rights reserved. This program is free software; you can redistribute it
150150 and/or modify it under the same terms as Perl itself.
22 # Make sure we have version info for this module
33 # Make sure we do everything by the book from now on
44
5 $VERSION = '0.33';
5 $VERSION = '0.34';
66 use strict;
77
88 # Satisfy -require-
174174 =head1 COPYRIGHT
175175
176176 Copyright (c)
177 2005-2009 Eric Rybski <rybskej@yahoo.com>,
177 2005-2010 Eric Rybski <rybskej@yahoo.com>,
178178 2002-2004 Elizabeth Mattijsen <liz@dijkmat.nl>.
179179 All rights reserved. This program is free software; you can redistribute it
180180 and/or modify it under the same terms as Perl itself.
22 # Make sure we have version info for this module
33 # Make sure we do everything by the book from now on
44
5 $VERSION = '0.33';
5 $VERSION = '0.34';
66 use strict;
77 use Scalar::Util;
88
101101 =head1 COPYRIGHT
102102
103103 Copyright (c)
104 2005-2009 Eric Rybski <rybskej@yahoo.com>,
104 2005-2010 Eric Rybski <rybskej@yahoo.com>,
105105 2002-2004 Elizabeth Mattijsen <liz@dijkmat.nl>.
106106 All rights reserved. This program is free software; you can redistribute it
107107 and/or modify it under the same terms as Perl itself.
22 # Make sure we have version info for this module
33 # Make sure we do everything by the book from now on
44
5 $VERSION = '0.33';
5 $VERSION = '0.34';
66 use strict;
77 use Scalar::Util;
88
6868 =head1 COPYRIGHT
6969
7070 Copyright (c)
71 2005-2009 Eric Rybski <rybskej@yahoo.com>,
71 2005-2010 Eric Rybski <rybskej@yahoo.com>,
7272 2002-2004 Elizabeth Mattijsen <liz@dijkmat.nl>.
7373 All rights reserved. This program is free software; you can redistribute it
7474 and/or modify it under the same terms as Perl itself.
33 /*
44 ----------------------------------------------------------------------
55
6 ppport.h -- Perl/Pollution/Portability Version 3.16
6 ppport.h -- Perl/Pollution/Portability Version 3.19
77
88 Automatically created by Devel::PPPort running under perl 5.008008.
99
2222 if (@ARGV && $ARGV[0] eq '--unstrip') {
2323 eval { require Devel::PPPort };
2424 $@ 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"
2727 . "Your Devel::PPPort is only version $Devel::PPPort::VERSION.\n"
2828 . "Please install a newer version, or --unstrip will not work.\n";
2929 }
544544 #endif
545545 #define INT2PTR(any,d) (any)(PTRV)(d)
546546 #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
551549 #if PTRSIZE == LONGSIZE
552550 #define PTR2ul(p) (unsigned long)(p)
553551 #else
554552 #define PTR2ul(p) INT2PTR(unsigned long,p)
555553 #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)
556569 #endif
557570 #undef START_EXTERN_C
558571 #undef END_EXTERN_C
652665 PL_stack_sp = PL_stack_base + ax + ((off) - 1); \
653666 return; \
654667 } 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))
655674 #endif
656675 #ifndef PERL_ABS
657676 #define PERL_ABS(x) ((x) < 0 ? -(x) : (x))
788807 #define PL_dirty dirty
789808 #define PL_dowarn dowarn
790809 #define PL_errgv errgv
810 #define PL_error_count error_count
791811 #define PL_expect expect
792812 #define PL_hexdigit hexdigit
793813 #define PL_hints hints
814 #define PL_in_my in_my
794815 #define PL_laststatval laststatval
795816 #define PL_lex_state lex_state
796817 #define PL_lex_stuff lex_stuff
844865 #define PL_lex_state D_PPP_my_PL_parser_var(lex_state)
845866 #define PL_lex_stuff D_PPP_my_PL_parser_var(lex_stuff)
846867 #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)
847871 #else
848872 #define PL_parser ((void *) 1)
849873 #endif
12501274 #ifndef SvREFCNT_inc_simple_void_NN
12511275 #define SvREFCNT_inc_simple_void_NN(sv) (void)(++SvREFCNT((SV*)(sv)))
12521276 #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
12531299 #if (PERL_BCDVERSION < 0x5006000)
12541300 #define D_PPP_CONSTPV_ARG(x) ((char *) (x))
12551301 #else
17151761 #ifndef SvSHARED_HASH
17161762 #define SvSHARED_HASH(sv) (0 + SvUVX(sv))
17171763 #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
17181776 #ifndef WARN_ALL
17191777 #define WARN_ALL 0
17201778 #endif
19111969 #endif
19121970 #ifndef hv_stores
19131971 #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)
19141981 #endif
19151982 #ifndef SvGETMAGIC
19161983 #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) );
7171
7272 # Check that main thread waits full 5 seconds after CHLD signal
7373 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) }) && !$@;
7575 $t1 = threads->new(sub { sleep 1; });
7676 $time = &Time::HiRes::usleep(5000000);
7777 $t1->join();
8282
8383 # Check that main thread waits full 5 seconds after CHLD signal
8484 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)
8686 unless &Time::HiRes::d_nanosleep && defined(my $t = eval { &Time::HiRes::nanosleep(0) }) && !$@;
8787 $t1 = threads->new(sub { sleep 1; });
8888 $time = &Time::HiRes::nanosleep(5000000000);