summaryrefslogtreecommitdiff
path: root/src/event-loop.c
diff options
context:
space:
mode:
authorJason Ekstrand <jason@jlekstrand.net>2013-01-11 21:01:47 -0600
committerKristian Høgsberg <krh@bitplanet.net>2013-01-15 14:05:27 -0500
commit2423497b999c999528a7d2380a13fcb3e3412d0a (patch)
tree3428a59502eda4bbba3bd320bc856a0a41bd0d49 /src/event-loop.c
parent31511d0ea08e9419bf6a3169ea196a551b4a94be (diff)
downloadwayland-2423497b999c999528a7d2380a13fcb3e3412d0a.tar.gz
Add a destroy signal to the wl_event_loop object
Diffstat (limited to 'src/event-loop.c')
-rw-r--r--src/event-loop.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/event-loop.c b/src/event-loop.c
index 8db9c7c..25e8f9c 100644
--- a/src/event-loop.c
+++ b/src/event-loop.c
@@ -43,6 +43,8 @@ struct wl_event_loop {
struct wl_list check_list;
struct wl_list idle_list;
struct wl_list destroy_list;
+
+ struct wl_signal destroy_signal;
};
struct wl_event_source_interface {
@@ -357,12 +359,16 @@ wl_event_loop_create(void)
wl_list_init(&loop->idle_list);
wl_list_init(&loop->destroy_list);
+ wl_signal_init(&loop->destroy_signal);
+
return loop;
}
WL_EXPORT void
wl_event_loop_destroy(struct wl_event_loop *loop)
{
+ wl_signal_emit(&loop->destroy_signal, loop);
+
wl_event_loop_process_destroy_list(loop);
close(loop->epoll_fd);
free(loop);
@@ -429,3 +435,18 @@ wl_event_loop_get_fd(struct wl_event_loop *loop)
{
return loop->epoll_fd;
}
+
+WL_EXPORT void
+wl_event_loop_add_destroy_listener(struct wl_event_loop *loop,
+ struct wl_listener *listener)
+{
+ wl_signal_add(&loop->destroy_signal, listener);
+}
+
+WL_EXPORT struct wl_listener *
+wl_event_loop_get_destroy_listener(struct wl_event_loop *loop,
+ wl_notify_func_t notify)
+{
+ wl_signal_get(&loop->destroy_signal, notify);
+}
+