… | |
… | |
27 | do_the_C_thing (); |
27 | do_the_C_thing (); |
28 | perlinterp_acquire (); |
28 | perlinterp_acquire (); |
29 | |
29 | |
30 | // optional, in BOOT section: |
30 | // optional, in BOOT section: |
31 | |
31 | |
32 | perlmulticore_advertise (); |
32 | perlmulticore_support (); |
33 | |
33 | |
34 | =head1 DESCRIPTION |
34 | =head1 DESCRIPTION |
35 | |
35 | |
36 | This documentation is the abridged version of the full documention at |
36 | This documentation is the abridged version of the full documention at |
37 | L<http://perlmulticore.schmorp.de/>. It's recommended to go there instead |
37 | L<http://perlmulticore.schmorp.de/>. It's recommended to go there instead |
… | |
… | |
125 | |
125 | |
126 | |
126 | |
127 | =head1 ADVERTISING MULTICORE API SUPPORT |
127 | =head1 ADVERTISING MULTICORE API SUPPORT |
128 | |
128 | |
129 | To help users find out whether a particular build of your module is, in |
129 | To help users find out whether a particular build of your module is, in |
130 | fact, multicore enabled, you can invoke the C<perlmulticore_advertise> |
130 | fact, multicore enabled, you can invoke the C<perlmulticore_support> |
131 | macro in your C<BOOT:> section, e.g.: |
131 | macro in your C<BOOT:> section, e.g.: |
132 | |
132 | |
133 | |
133 | |
134 | MODULE = My::Mod PACKAGE = My::Mod::Pkg |
134 | MODULE = My::Mod PACKAGE = My::Mod::Pkg |
135 | |
135 | |
136 | BOOT: |
136 | BOOT: |
137 | perlmulticore_advertise (); |
137 | perlmulticore_support (); |
138 | |
138 | |
139 | What this does is set the C<$My::Mod::PERLMULTICORE_SUPPORT> variable to |
139 | What this does is set the C<$My::Mod::PERLMULTICORE_SUPPORT> variable to |
140 | the major API version * 1000 + minor version, for example, version C<1002> |
140 | the major API version * 1000 + minor version, for example, version C<1002> |
141 | introduced this feature. |
141 | introduced this feature. |
142 | |
142 | |
… | |
… | |
167 | #define PERL_MULTICORE_MAJOR 1 /* bumped on incompatible changes */ |
167 | #define PERL_MULTICORE_MAJOR 1 /* bumped on incompatible changes */ |
168 | #define PERL_MULTICORE_MINOR 2 /* bumped on every change */ |
168 | #define PERL_MULTICORE_MINOR 2 /* bumped on every change */ |
169 | |
169 | |
170 | #if PERL_MULTICORE_DISABLE |
170 | #if PERL_MULTICORE_DISABLE |
171 | |
171 | |
172 | #define perlinterp_release() do { } while (0) |
172 | #define perlinterp_release() do { } while (0) |
173 | #define perlinterp_acquire() do { } while (0) |
173 | #define perlinterp_acquire() do { } while (0) |
174 | #define perlmulticore_advertise() do { } while (0) |
174 | #define perlmulticore_support() do { } while (0) |
175 | |
175 | |
176 | #else |
176 | #else |
177 | |
177 | |
178 | START_EXTERN_C |
178 | START_EXTERN_C |
179 | |
179 | |
… | |
… | |
235 | |
235 | |
236 | /* call the real (or dummy) implementation now */ |
236 | /* call the real (or dummy) implementation now */ |
237 | perlinterp_release (); |
237 | perlinterp_release (); |
238 | } |
238 | } |
239 | |
239 | |
240 | #define perlmulticore_advertise() \ |
240 | #define perlmulticore_support() \ |
241 | sv_setiv (get_sv ( \ |
241 | sv_setiv (get_sv ( \ |
242 | form ("%s::PERLMULTICORE_SUPPORT", HvNAME (GvSTASH (CvGV (cv)))), \ |
242 | form ("%s::PERLMULTICORE_SUPPORT", HvNAME (GvSTASH (CvGV (cv)))), \ |
243 | GV_ADD | GV_ADDMULTI), \ |
243 | GV_ADD | GV_ADDMULTI), \ |
244 | PERL_MULTICORE_MAJOR * 1000 + PERL_MULTICORE_MINOR); \ |
244 | PERL_MULTICORE_MAJOR * 1000 + PERL_MULTICORE_MINOR); \ |
245 | |
245 | |