unix: rework uv_eio_init() init once logic

Don't use counters.eio_init to track if libeio has been initialized, it's going
to be removed in a follow-up commit.
This commit is contained in:
Ben Noordhuis 2012-08-10 01:45:40 +02:00
parent 75ba681913
commit caa79af2ad
3 changed files with 9 additions and 3 deletions

View File

@ -117,6 +117,7 @@ struct uv__io_s {
#endif
#define UV_LOOP_PRIVATE_FIELDS \
unsigned long flags; \
/* Poll result queue */ \
eio_channel uv_eio_channel; \
struct ev_loop* ev; \

View File

@ -82,7 +82,7 @@
#define UV__IO_WRITE EV_WRITE
#define UV__IO_ERROR EV_ERROR
/* flags */
/* handle flags */
enum {
UV_CLOSING = 0x01, /* uv_close() called but not finished. */
UV_CLOSED = 0x02, /* close(2) finished. */
@ -97,6 +97,11 @@ enum {
UV_TCP_SINGLE_ACCEPT = 0x400 /* Only accept() when idle. */
};
/* loop flags */
enum {
UV_LOOP_EIO_INITIALIZED = 1
};
inline static void uv__req_init(uv_loop_t* loop,
uv_req_t* req,
uv_req_type type) {

View File

@ -83,8 +83,8 @@ static void uv__eio_init(void) {
void uv_eio_init(uv_loop_t* loop) {
if (loop->counters.eio_init) return;
loop->counters.eio_init = 1;
if (loop->flags & UV_LOOP_EIO_INITIALIZED) return;
loop->flags |= UV_LOOP_EIO_INITIALIZED;
uv_idle_init(loop, &loop->uv_eio_poller);
uv_idle_start(&loop->uv_eio_poller, uv_eio_do_poll);