summaryrefslogtreecommitdiffstats
path: root/src/events.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/events.cpp')
-rw-r--r--src/events.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/events.cpp b/src/events.cpp
index 45c4f1d..a034d4d 100644
--- a/src/events.cpp
+++ b/src/events.cpp
@@ -506,6 +506,22 @@ unsigned short t_event_tcp_ping::get_dst_port(void) const {
}
///////////////////////////////////////////////////////////
+// class t_event_fncall
+///////////////////////////////////////////////////////////
+
+t_event_fncall::t_event_fncall(std::function<void()> fn)
+ : m_fn(fn) {
+
+}
+void t_event_fncall::invoke() {
+ m_fn();
+}
+
+t_event_type t_event_fncall::get_type(void) const {
+ return EV_FN_CALL;
+}
+
+///////////////////////////////////////////////////////////
// class t_event_queue
///////////////////////////////////////////////////////////
@@ -545,6 +561,12 @@ void t_event_queue::push_quit(void) {
push(event);
}
+void t_event_queue::push_fncall(std::function<void()> fn) {
+ t_event_fncall* event = new t_event_fncall(fn);
+ MEMMAN_NEW(event);
+ push(event);
+}
+
void t_event_queue::push_network(t_sip_message *m, const t_ip_port &ip_port) {
t_event_network *event = new t_event_network(m);
MEMMAN_NEW(event);