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.11 by root, Sun Jul 5 02:52:15 2015 UTC vs.
Revision 1.12 by root, Sun Jul 5 03:50:57 2015 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
27static pthread_key_t current_key; 27static X_TLS_DECLARE(current_key);
28 28
29static s_epipe ep; 29static s_epipe ep;
30static void *perl_thx; 30static void *perl_thx;
31static sigset_t cursigset, fullsigset; 31static sigset_t cursigset, fullsigset;
32 32
175static void 175static void
176pmapi_release (void) 176pmapi_release (void)
177{ 177{
178 if (!(thread_enable ? thread_enable & 1 : global_enable)) 178 if (!(thread_enable ? thread_enable & 1 : global_enable))
179 { 179 {
180 pthread_setspecific (current_key, 0); 180 X_TLS_SET (current_key, 0);
181 return; 181 return;
182 } 182 }
183 183
184 struct tctx *ctx = tctx_get (); 184 struct tctx *ctx = tctx_get ();
185 ctx->coro = SvREFCNT_inc_NN (CORO_CURRENT); 185 ctx->coro = SvREFCNT_inc_NN (CORO_CURRENT);
186 ctx->wait_f = 0; 186 ctx->wait_f = 0;
187 187
188 pthread_setspecific (current_key, ctx); 188 X_TLS_SET (current_key, ctx);
189 pthread_sigmask (SIG_SETMASK, &fullsigset, &cursigset); 189 pthread_sigmask (SIG_SETMASK, &fullsigset, &cursigset);
190 190
191 X_LOCK (release_m); 191 X_LOCK (release_m);
192 192
193 if (idle <= min_idle) 193 if (idle <= min_idle)
207 207
208static void 208static void
209pmapi_acquire (void) 209pmapi_acquire (void)
210{ 210{
211 int jeret; 211 int jeret;
212 struct tctx *ctx = pthread_getspecific (current_key); 212 struct tctx *ctx = X_TLS_GET (current_key);
213 213
214 if (!ctx) 214 if (!ctx)
215 return; 215 return;
216 216
217 X_LOCK (acquire_m); 217 X_LOCK (acquire_m);
245{ 245{
246 #ifndef _WIN32 246 #ifndef _WIN32
247 sigfillset (&fullsigset); 247 sigfillset (&fullsigset);
248 #endif 248 #endif
249 249
250 pthread_key_create (&current_key, 0); 250 X_TLS_INIT (current_key);
251 251
252 if (s_epipe_new (&ep)) 252 if (s_epipe_new (&ep))
253 croak ("Coro::Multicore: unable to initialise event pipe.\n"); 253 croak ("Coro::Multicore: unable to initialise event pipe.\n");
254 254
255 perl_thx = PERL_GET_CONTEXT; 255 perl_thx = PERL_GET_CONTEXT;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines