diff options
author | root <root> | 2011-07-18 01:27:03 +0000 |
---|---|---|
committer | root <root> | 2011-07-18 01:27:03 +0000 |
commit | 7b5974c9e146f327c9a27f1d97d7fb6a8b95d15d (patch) | |
tree | 9506be71a97780feeab695d304b0c337cb4c8a9a /eio.c | |
parent | e8c0c783e3de2e8833b80eeb3210fbd859667203 (diff) |
*** empty log message ***
Diffstat (limited to 'eio.c')
-rw-r--r-- | eio.c | 36 |
1 files changed, 8 insertions, 28 deletions
@@ -304,7 +304,7 @@ static xcond_t reqwait; * normal read/write by using a mutex. slows down execution a lot, * but that's your problem, not mine. */ -static xmutex_t preadwritelock = X_MUTEX_INIT; +static xmutex_t preadwritelock; #endif typedef struct etp_worker @@ -320,7 +320,7 @@ typedef struct etp_worker ETP_WORKER_COMMON } etp_worker; -static etp_worker wrk_first = { &wrk_first, &wrk_first, 0 }; /* NOT etp */ +static etp_worker wrk_first; /* NOT etp */ #define ETP_WORKER_LOCK(wrk) X_LOCK (wrklock) #define ETP_WORKER_UNLOCK(wrk) X_UNLOCK (wrklock) @@ -455,21 +455,14 @@ reqq_shift (etp_reqq *q) abort (); } -static void ecb_cold -etp_thread_init (void) +static int ecb_cold +etp_init (void (*want_poll)(void), void (*done_poll)(void)) { -#if !HAVE_PREADWRITE - X_MUTEX_CREATE (preadwritelock); -#endif X_MUTEX_CREATE (wrklock); X_MUTEX_CREATE (reslock); X_MUTEX_CREATE (reqlock); X_COND_CREATE (reqwait); -} -static void ecb_cold -etp_atfork_child (void) -{ reqq_init (&req_queue); reqq_init (&res_queue); @@ -482,23 +475,6 @@ etp_atfork_child (void) nready = 0; npending = 0; - etp_thread_init (); -} - -static void ecb_cold -etp_once_init (void) -{ - etp_thread_init (); - X_THREAD_ATFORK (0, 0, etp_atfork_child); -} - -static int ecb_cold -etp_init (void (*want_poll)(void), void (*done_poll)(void)) -{ - static pthread_once_t doinit = PTHREAD_ONCE_INIT; - - pthread_once (&doinit, etp_once_init); - want_poll_cb = want_poll; done_poll_cb = done_poll; @@ -1993,6 +1969,10 @@ quit: int ecb_cold eio_init (void (*want_poll)(void), void (*done_poll)(void)) { +#if !HAVE_PREADWRITE + X_MUTEX_CREATE (preadwritelock); +#endif + return etp_init (want_poll, done_poll); } |