ctdb-daemon: Fix signed/unsigned comparison
[samba.git] / source3 / lib / tevent_glib_glue.h
blob0d001fa8ce95064e17988c9669850743e3c7d1cc
1 /*
2 Unix SMB/CIFS implementation.
3 Poll glib event loop from tevent
5 Copyright (C) Ralph Boehme 2016
7 ** NOTE! The following LGPL license applies to the tevent
8 ** library. This does NOT imply that all of Samba is released
9 ** under the LGPL
11 This library is free software; you can redistribute it and/or
12 modify it under the terms of the GNU Lesser General Public
13 License as published by the Free Software Foundation; either
14 version 3 of the License, or (at your option) any later version.
16 This library is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License for more details.
21 You should have received a copy of the GNU Lesser General Public
22 License along with this library; if not, see <http://www.gnu.org/licenses/>.
25 #ifndef _TEVENT_GLIB_GLUE_H
26 #define _TEVENT_GLIB_GLUE_H
28 #include <talloc.h>
29 #include <tevent.h>
31 /**
32 * @brief Add a glib GmainContext to a tevent context
34 * tevent will poll the glib event sources and run handlers for
35 * pending events as detailed in the glib documentation:
37 * https://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html
39 * If tevent was built without glib support, this function will always return
40 * NULL with an error number ENOSYS.
42 * @param[in] mem_ctx Memory context to use
44 * @param[in] ev Event context to use
46 * @param[in] gmain_ctx GMainContext that will be added to tevent
48 * @return A handle on the glue context that binds the
49 * the GMainContext to tevent. Pass the glue handle to
50 * tevent_glib_glue_quit() in a callback when you want
51 * stop processing glib events.
52 * You must not call talloc_free() on the handle while
53 * the loop is still in use and attached to tevent.
55 struct tevent_glib_glue *samba_tevent_glib_glue_create(TALLOC_CTX *mem_ctx,
56 struct tevent_context *ev,
57 GMainContext *gmain_ctx);
59 /**
60 * @brief Stop polling a GMainContext
62 * Used in a callback when you want to stop processing glib events.
64 * @param[in] glue And tevent_glib_glue handle
66 void samba_tevent_glib_glue_quit(struct tevent_glib_glue *glue);
68 #endif