ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro-Multicore/Multicore.xs
(Generate patch)

Comparing Coro-Multicore/Multicore.xs (file contents):
Revision 1.15 by root, Sat Dec 19 23:56:35 2015 UTC vs.
Revision 1.16 by root, Sun Jan 24 04:20:49 2016 UTC

22 22
23#ifndef SvREFCNT_inc_NN 23#ifndef SvREFCNT_inc_NN
24 #define SvREFCNT_inc_NN(sv) SvREFCNT_inc (sv) 24 #define SvREFCNT_inc_NN(sv) SvREFCNT_inc (sv)
25#endif 25#endif
26 26
27#define RECURSION_CHECK 0
28
27static X_TLS_DECLARE(current_key); 29static X_TLS_DECLARE(current_key);
30#if RECURSION_CHECK
31static X_TLS_DECLARE(check_key);
32#endif
33
28 34
29static s_epipe ep; 35static s_epipe ep;
30static void *perl_thx; 36static void *perl_thx;
31static sigset_t cursigset, fullsigset; 37static sigset_t cursigset, fullsigset;
32 38
173} 179}
174 180
175static void 181static void
176pmapi_release (void) 182pmapi_release (void)
177{ 183{
184 #if RECURSION_CHECK
185 if (X_TLS_GET (check_key))
186 croak ("perlinterp_release () called without valid perl context");
187
188 X_TLS_SET (check_key, &check_key);
189 #endif
190
178 if (! ((thread_enable ? thread_enable : global_enable) & 1)) 191 if (! ((thread_enable ? thread_enable : global_enable) & 1))
179 { 192 {
180 X_TLS_SET (current_key, 0); 193 X_TLS_SET (current_key, 0);
181 return; 194 return;
182 } 195 }
208static void 221static void
209pmapi_acquire (void) 222pmapi_acquire (void)
210{ 223{
211 int jeret; 224 int jeret;
212 struct tctx *ctx = X_TLS_GET (current_key); 225 struct tctx *ctx = X_TLS_GET (current_key);
226
227 #if RECURSION_CHECK
228 if (X_TLS_GET (check_key) != &check_key)
229 croak ("perlinterp_acquire () called with valid perl context");
230
231 X_TLS_SET (check_key, 0);
232 #endif
213 233
214 if (!ctx) 234 if (!ctx)
215 return; 235 return;
216 236
217 X_LOCK (acquire_m); 237 X_LOCK (acquire_m);
241 261
242PROTOTYPES: DISABLE 262PROTOTYPES: DISABLE
243 263
244BOOT: 264BOOT:
245{ 265{
246 #ifndef _WIN32 266#ifndef _WIN32
247 sigfillset (&fullsigset); 267 sigfillset (&fullsigset);
248 #endif 268#endif
249 269
250 X_TLS_INIT (current_key); 270 X_TLS_INIT (current_key);
271#if RECURSION_CHECK
272 X_TLS_INIT (check_key);
273#endif
251 274
252 if (s_epipe_new (&ep)) 275 if (s_epipe_new (&ep))
253 croak ("Coro::Multicore: unable to initialise event pipe.\n"); 276 croak ("Coro::Multicore: unable to initialise event pipe.\n");
254 277
255 perl_thx = PERL_GET_CONTEXT; 278 perl_thx = PERL_GET_CONTEXT;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines