summaryrefslogtreecommitdiff
path: root/eio.c
diff options
context:
space:
mode:
authorroot <root>2011-07-18 01:27:03 +0000
committerroot <root>2011-07-18 01:27:03 +0000
commit7b5974c9e146f327c9a27f1d97d7fb6a8b95d15d (patch)
tree9506be71a97780feeab695d304b0c337cb4c8a9a /eio.c
parente8c0c783e3de2e8833b80eeb3210fbd859667203 (diff)
*** empty log message ***
Diffstat (limited to 'eio.c')
-rw-r--r--eio.c36
1 files changed, 8 insertions, 28 deletions
diff --git a/eio.c b/eio.c
index 4d70cd5..b367868 100644
--- a/eio.c
+++ b/eio.c
@@ -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);
}