From 8daa83a594a2e98f39d764422bfbdbc62c9efd44 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 19:20:00 +0200 Subject: Adding upstream version 2:4.20.0+dfsg. Signed-off-by: Daniel Baumann --- source3/lib/tevent_glib_glue.h | 68 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 source3/lib/tevent_glib_glue.h (limited to 'source3/lib/tevent_glib_glue.h') diff --git a/source3/lib/tevent_glib_glue.h b/source3/lib/tevent_glib_glue.h new file mode 100644 index 0000000..0d001fa --- /dev/null +++ b/source3/lib/tevent_glib_glue.h @@ -0,0 +1,68 @@ +/* + Unix SMB/CIFS implementation. + Poll glib event loop from tevent + + Copyright (C) Ralph Boehme 2016 + + ** NOTE! The following LGPL license applies to the tevent + ** library. This does NOT imply that all of Samba is released + ** under the LGPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef _TEVENT_GLIB_GLUE_H +#define _TEVENT_GLIB_GLUE_H + +#include +#include + +/** + * @brief Add a glib GmainContext to a tevent context + * + * tevent will poll the glib event sources and run handlers for + * pending events as detailed in the glib documentation: + * + * https://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html + * + * If tevent was built without glib support, this function will always return + * NULL with an error number ENOSYS. + * + * @param[in] mem_ctx Memory context to use + * + * @param[in] ev Event context to use + * + * @param[in] gmain_ctx GMainContext that will be added to tevent + * + * @return A handle on the glue context that binds the + * the GMainContext to tevent. Pass the glue handle to + * tevent_glib_glue_quit() in a callback when you want + * stop processing glib events. + * You must not call talloc_free() on the handle while + * the loop is still in use and attached to tevent. + */ +struct tevent_glib_glue *samba_tevent_glib_glue_create(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + GMainContext *gmain_ctx); + +/** + * @brief Stop polling a GMainContext + * + * Used in a callback when you want to stop processing glib events. + * + * @param[in] glue And tevent_glib_glue handle + */ +void samba_tevent_glib_glue_quit(struct tevent_glib_glue *glue); + +#endif -- cgit v1.2.3