This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
parts/inc/threads: Add hints
[perl5.git] / dist / Devel-PPPort / parts / inc / threads
1 ################################################################################
2 ##
3 ##  Version 3.x, Copyright (C) 2004-2013, Marcus Holland-Moritz.
4 ##  Version 2.x, Copyright (C) 2001, Paul Marquess.
5 ##  Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
6 ##
7 ##  This program is free software; you can redistribute it and/or
8 ##  modify it under the same terms as Perl itself.
9 ##
10 ################################################################################
11
12 =provides
13
14 __UNDEFINED__
15 aTHXR
16 aTHXR_
17 dTHXR
18
19 =implementation
20
21 __UNDEFINED__  dTHR       dNOOP
22
23 __UNDEFINED__  dTHX       dNOOP
24 /* Hint: dTHX
25
26   For pre-5.6.0 thread compatibility, instead use dTHXR, available only through
27   ppport.h */
28
29 __UNDEFINED__  dTHXa(x)   dNOOP
30
31 __UNDEFINED__  pTHX       void
32 __UNDEFINED__  pTHX_
33 __UNDEFINED__  aTHX
34 /* Hint: aTHX
35
36   For pre-5.6.0 thread compatibility, instead use aTHXR, available only through
37   ppport.h */
38
39 __UNDEFINED__  aTHX_
40 /* Hint: aTHX_
41
42   For pre-5.6.0 thread compatibility, instead use aTHXR_, available only
43   through ppport.h */
44
45 #if { VERSION < 5.6.0 }
46 #  ifdef USE_THREADS
47 #    define aTHXR  thr
48 #    define aTHXR_ thr,
49 #  else
50 #    define aTHXR
51 #    define aTHXR_
52 #  endif
53 #  define dTHXR  dTHR
54 #else
55 #  define aTHXR  aTHX
56 #  define aTHXR_ aTHX_
57 #  define dTHXR  dTHX
58 #endif
59
60 __UNDEFINED__  dTHXoa(x)  dTHXa(x)
61
62 =xsubs
63
64 IV
65 no_THX_arg(sv)
66         SV *sv
67         CODE:
68                 RETVAL = 1 + sv_2iv(sv);
69         OUTPUT:
70                 RETVAL
71
72 void
73 with_THX_arg(error)
74         SV *error
75         PPCODE:
76                 croak_sv(error);
77
78 =tests plan => 2
79
80 ok(&Devel::PPPort::no_THX_arg("42"), 43);
81 eval { &Devel::PPPort::with_THX_arg("yes\n"); };
82 ok($@ =~ /^yes/);