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.24 by root, Wed Aug 17 03:01:56 2005 UTC vs.
Revision 1.25 by root, Wed Aug 17 03:16:56 2005 UTC

267 267
268static int fork_started; 268static int fork_started;
269 269
270static void atfork_prepare (void) 270static void atfork_prepare (void)
271{ 271{
272 pthread_mutex_lock (&frklock); 272 int nstarted;
273
274 fork_started = started;
275 273
276 for (;;) { 274 for (;;) {
277 while (nreqs) 275 while (nreqs)
278 { 276 {
279 poll_wait (); 277 poll_wait ();
280 poll_cb (); 278 poll_cb ();
281 } 279 }
282 280
281 nstarted = started;
283 max_parallel (0); 282 max_parallel (0);
284 283
285 pthread_mutex_lock (&reqlock); 284 pthread_mutex_lock (&reqlock);
286 285
287 if (!nreqs && !started) 286 if (!nreqs && !started)
290 pthread_mutex_unlock (&reqlock); 289 pthread_mutex_unlock (&reqlock);
291 290
292 min_parallel (fork_started); 291 min_parallel (fork_started);
293 } 292 }
294 293
294 pthread_mutex_lock (&frklock);
295 fork_started = nstarted;
295 pthread_mutex_lock (&reslock); 296 pthread_mutex_lock (&reslock);
296 297
297 assert (!started); 298 assert (!started);
298 assert (!nreqs); 299 assert (!nreqs);
299 assert (!reqs && !reqe); 300 assert (!reqs && !reqe);
301} 302}
302 303
303static void atfork_parent (void) 304static void atfork_parent (void)
304{ 305{
305 pthread_mutex_unlock (&reslock); 306 pthread_mutex_unlock (&reslock);
307 pthread_mutex_unlock (&frklock);
308 pthread_mutex_unlock (&reqlock);
309
306 min_parallel (fork_started); 310 min_parallel (fork_started);
307 pthread_mutex_unlock (&reqlock);
308 pthread_mutex_unlock (&frklock);
309} 311}
310 312
311static void atfork_child (void) 313#define atfork_child atfork_parent
312{
313 reqs = reqe = 0;
314
315 atfork_parent ();
316}
317 314
318/*****************************************************************************/ 315/*****************************************************************************/
319/* work around various missing functions */ 316/* work around various missing functions */
320 317
321#if !HAVE_PREADWRITE 318#if !HAVE_PREADWRITE

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines