To be used from threads that want to call the callback
from the main(gui) thread. Users must provide
synhronization of the callback data.
Difference with using timeouts are:
Threads can have own timers
Timer events are low priority, this must be called ASAP.
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk/navit@1674
ffa7fe5e-494d-0410-b361-
a75ebd5db220
event_methods.remove_idle(ev);
}
+void
+event_call_callback(struct callback *cb)
+{
+ event_methods.call_callback(cb);
+}
+
int
event_request_system(char *system, char *requestor)
{
void (*remove_timeout)(struct event_timeout *ev);
struct event_idle *(*add_idle)(struct callback *cb);
void (*remove_idle)(struct event_idle *ev);
+ void (*call_callback)(struct callback *cb);
};
struct event_idle *event_add_idle(struct callback *cb);
void event_remove_idle(struct event_idle *ev);
int event_request_system(char *system, char *requestor);
+void event_call_callback(struct callback *cb);
/* end of prototypes */
#ifdef __cplusplus
}
{
}
+static void
+event_glib_call_callback(struct callback *cb)
+{
+/*
+ Idea for implementation:
+ Create a pipe then use add_watch
+ add callback to a queue
+ from here write to the pipe to wakeup the pool
+ then from the gui thread process the callback queue
+*/
+}
+
static struct event_methods event_glib_methods = {
event_glib_main_loop_run,
event_glib_main_loop_quit,
event_glib_remove_timeout,
event_glib_add_idle,
event_glib_remove_idle,
+ event_glib_call_callback,
};
static void
dbg(0,"enter\n");
}
+static void
+event_qt_call_callback(struct callback *cb)
+{
+ dbg(0,"enter\n");
+}
+
static struct event_methods event_qt_methods = {
event_qt_main_loop_run,
event_qt_main_loop_quit,
event_qt_remove_timeout,
event_qt_add_idle,
event_qt_remove_idle,
+ event_qt_call_callback,
};
struct event_priv {
dbg(0,"enter\n");
}
+static void
+event_win32_call_callback(struct callback *cb)
+{
+ dbg(0,"enter\n");
+}
+
static struct event_methods event_win32_methods = {
event_win32_main_loop_run,
event_win32_main_loop_quit,
event_win32_remove_timeout,
event_win32_add_idle,
event_win32_remove_idle,
+ event_win32_call_callback,
};
static struct event_priv *