From d84677907711b87bed5c1ecb34ea6a68fc2081da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Thu, 13 May 2010 12:17:32 +0200 Subject: [PATCH] Add li_ev_safe_unref_and_start to utils.h --- include/lighttpd/utils.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/lighttpd/utils.h b/include/lighttpd/utils.h index 7d91111..6847eca 100644 --- a/include/lighttpd/utils.h +++ b/include/lighttpd/utils.h @@ -36,6 +36,14 @@ LI_API void li_ev_io_set_events(struct ev_loop *loop, ev_io *watcher, int events } \ } while (0) +#define li_ev_safe_unref_and_start(startf, loop, watcher) do { \ + ev_watcher *__w = (ev_watcher*) watcher; \ + if (!ev_is_active(__w)) { \ + startf(loop, watcher); \ + ev_unref(loop); \ + } \ +} while (0) + /* URL inplace decode: replace %XX with character \xXX; replace control characters with '_' (< 32 || == 127) */ LI_API void li_url_decode(GString *path);