From 485804e1eaa0580124a1c94123822912811eaf88 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 15 Nov 2007 09:19:42 +0000 Subject: optimise ev_default_loop --- ev.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'ev.h') diff --git a/ev.h b/ev.h index f2ec3f2..af6c2da 100644 --- a/ev.h +++ b/ev.h @@ -269,7 +269,17 @@ void ev_set_syserr_cb (void (*cb)(const char *msg)); # if EV_MULTIPLICITY /* the default loop is the only one that handles signals and child watchers */ /* you can call this as often as you like */ -struct ev_loop *ev_default_loop (unsigned int flags); /* returns default loop */ +static struct ev_loop * +ev_default_loop (unsigned int flags) +{ + extern struct ev_loop *ev_default_loop_ptr; + extern struct ev_loop *ev_default_loop_ (unsigned int flags); + + if (!ev_default_loop_ptr) + ev_default_loop_ (flags); + + return ev_default_loop_ptr; +} /* create and destroy alternative loops that don't handle signals */ struct ev_loop *ev_loop_new (unsigned int flags); -- cgit v1.2.3