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

Comparing IO-AIO/AIO.xs (file contents):
Revision 1.27 by root, Wed Aug 17 04:47:02 2005 UTC vs.
Revision 1.28 by root, Wed Aug 17 05:06:59 2005 UTC

142 errno = req->errorno; 142 errno = req->errorno;
143 143
144 if (req->type == REQ_READ) 144 if (req->type == REQ_READ)
145 SvCUR_set (req->data, req->dataoffset + (req->result > 0 ? req->result : 0)); 145 SvCUR_set (req->data, req->dataoffset + (req->result > 0 ? req->result : 0));
146 146
147 if (req->data2ptr && (req->type == REQ_READ || req->type == REQ_WRITE))
148 SvREADONLY_off (req->data);
149
147 if (req->statdata) 150 if (req->statdata)
148 { 151 {
149 PL_laststype = req->type == REQ_LSTAT ? OP_LSTAT : OP_STAT; 152 PL_laststype = req->type == REQ_LSTAT ? OP_LSTAT : OP_STAT;
150 PL_laststatval = req->result; 153 PL_laststatval = req->result;
151 PL_statcache = *(req->statdata); 154 PL_statcache = *(req->statdata);
294 croak ("cannot set result pipe to nonblocking mode"); 297 croak ("cannot set result pipe to nonblocking mode");
295} 298}
296 299
297static void atfork_prepare (void) 300static void atfork_prepare (void)
298{ 301{
299 for (;;) {
300
301 for (;;)
302 {
303 poll_cb ();
304
305 if (!nreqs)
306 break;
307
308 poll_wait ();
309 }
310
311 pthread_mutex_lock (&reqlock); 302 pthread_mutex_lock (&reqlock);
312
313 if (!nreqs)
314 break;
315
316 pthread_mutex_unlock (&reqlock);
317 }
318
319 pthread_mutex_lock (&reslock); 303 pthread_mutex_lock (&reslock);
320
321 assert (!nreqs && !reqs && !ress);
322} 304}
323 305
324static void atfork_parent (void) 306static void atfork_parent (void)
325{ 307{
326 pthread_mutex_unlock (&reslock); 308 pthread_mutex_unlock (&reslock);
327 pthread_mutex_unlock (&reqlock); 309 pthread_mutex_unlock (&reqlock);
328} 310}
329 311
330static void atfork_child (void) 312static void atfork_child (void)
331{ 313{
314 aio_req prv;
315
332 int restart = started; 316 int restart = started;
333 started = 0; 317 started = 0;
318
319 while (reqs)
320 {
321 prv = reqs;
322 reqs = prv->next;
323 free_req (prv);
324 }
325
326 reqs = reqe = 0;
327
328 while (ress)
329 {
330 prv = ress;
331 ress = prv->next;
332 free_req (prv);
333 }
334
335 ress = rese = 0;
334 336
335 atfork_parent (); 337 atfork_parent ();
336 338
337 min_parallel (restart); 339 min_parallel (restart);
338} 340}
629 req->offset = offset; 631 req->offset = offset;
630 req->length = length; 632 req->length = length;
631 req->data = SvREFCNT_inc (data); 633 req->data = SvREFCNT_inc (data);
632 req->dataptr = (char *)svptr + dataoffset; 634 req->dataptr = (char *)svptr + dataoffset;
633 635
636 if (!SvREADONLY (data))
637 {
638 SvREADONLY_on (data);
639 req->data2ptr = (void *)data;
640 }
641
634 send_req (req); 642 send_req (req);
635 } 643 }
636} 644}
637 645
638void 646void

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines