blob: 0d001fa8ce95064e17988c9669850743e3c7d1cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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 <http://www.gnu.org/licenses/>.
*/
#ifndef _TEVENT_GLIB_GLUE_H
#define _TEVENT_GLIB_GLUE_H
#include <talloc.h>
#include <tevent.h>
/**
* @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
|