… | |
… | |
330 | |
330 | |
331 | static void etp_atfork_child (void) |
331 | static void etp_atfork_child (void) |
332 | { |
332 | { |
333 | ETP_REQ *prv; |
333 | ETP_REQ *prv; |
334 | |
334 | |
335 | while (prv = reqq_shift (&req_queue)) |
335 | while ((prv = reqq_shift (&req_queue))) |
336 | ETP_DESTROY (prv); |
336 | ETP_DESTROY (prv); |
337 | |
337 | |
338 | while (prv = reqq_shift (&res_queue)) |
338 | while ((prv = reqq_shift (&res_queue))) |
339 | ETP_DESTROY (prv); |
339 | ETP_DESTROY (prv); |
340 | |
340 | |
341 | while (wrk_first.next != &wrk_first) |
341 | while (wrk_first.next != &wrk_first) |
342 | { |
342 | { |
343 | etp_worker *wrk = wrk_first.next; |
343 | etp_worker *wrk = wrk_first.next; |
… | |
… | |
371 | |
371 | |
372 | pthread_once (&doinit, etp_once_init); |
372 | pthread_once (&doinit, etp_once_init); |
373 | |
373 | |
374 | want_poll_cb = want_poll; |
374 | want_poll_cb = want_poll; |
375 | done_poll_cb = done_poll; |
375 | done_poll_cb = done_poll; |
|
|
376 | |
|
|
377 | return 0; |
376 | } |
378 | } |
377 | |
379 | |
378 | X_THREAD_PROC (etp_proc); |
380 | X_THREAD_PROC (etp_proc); |
379 | |
381 | |
380 | static void etp_start_thread (void) |
382 | static void etp_start_thread (void) |
… | |
… | |
901 | int memlen = 4096; |
903 | int memlen = 4096; |
902 | int memofs = 0; |
904 | int memofs = 0; |
903 | int res = 0; |
905 | int res = 0; |
904 | |
906 | |
905 | X_LOCK (wrklock); |
907 | X_LOCK (wrklock); |
|
|
908 | /* the corresponding closedir is in ETP_WORKER_CLEAR */ |
906 | self->dirp = dirp = opendir (req->ptr1); |
909 | self->dirp = dirp = opendir (req->ptr1); |
907 | req->flags |= EIO_FLAG_PTR2_FREE; |
910 | req->flags |= EIO_FLAG_PTR2_FREE; |
908 | req->ptr2 = names = malloc (memlen); |
911 | req->ptr2 = names = malloc (memlen); |
909 | X_UNLOCK (wrklock); |
912 | X_UNLOCK (wrklock); |
910 | |
913 | |
… | |
… | |
1039 | |
1042 | |
1040 | /*****************************************************************************/ |
1043 | /*****************************************************************************/ |
1041 | |
1044 | |
1042 | int eio_init (void (*want_poll)(void), void (*done_poll)(void)) |
1045 | int eio_init (void (*want_poll)(void), void (*done_poll)(void)) |
1043 | { |
1046 | { |
1044 | etp_init (want_poll, done_poll); |
1047 | return etp_init (want_poll, done_poll); |
1045 | } |
1048 | } |
1046 | |
1049 | |
1047 | static void eio_api_destroy (eio_req *req) |
1050 | static void eio_api_destroy (eio_req *req) |
1048 | { |
1051 | { |
1049 | free (req); |
1052 | free (req); |