aboutsummaryrefslogtreecommitdiff
path: root/src/event.cpp
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2019-06-16 23:24:49 -0400
committerDeterminant <[email protected]>2019-06-16 23:24:49 -0400
commit74e4246565ba5814a92ed9f84b13b17226f219d1 (patch)
tree161a15482225dce9a3940e70bfd3b5e1a50cf497 /src/event.cpp
parent77a765023bff4fa3d41001bdc1de9d106e35f348 (diff)
do not free the moved pointer for C API; misc changes
Diffstat (limited to 'src/event.cpp')
-rw-r--r--src/event.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/event.cpp b/src/event.cpp
index 4e5ce0b..2fe2861 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -28,14 +28,22 @@ void threadcall_async_call(threadcall_t *self, threadcall_callback_t callback, v
});
}
-eventcontext_t *threadcall_get_ec(threadcall_t *self) {
- return new eventcontext_t(self->get_ec());
+const eventcontext_t *threadcall_get_ec(const threadcall_t *self) {
+ return &self->get_ec();
}
void sigev_free(sigev_t *self) { delete self; }
void sigev_add(sigev_t *self, int signum) { self->add(signum); }
+void sigev_del(sigev_t *self) { self->del(); }
+
+void sigev_clear(sigev_t *self) { self->clear(); }
+
+const eventcontext_t *sigev_get_ec(const sigev_t *self) {
+ return &self->get_ec();
+}
+
timerev_t *timerev_new(const eventcontext_t *ec, timerev_callback_t callback, void *userdata) {
return new timerev_t(*ec, [=](salticidae::TimerEvent &ev) {
callback(&ev, userdata);
@@ -48,6 +56,11 @@ void timerev_set_callback(timerev_t *self, timerev_callback_t callback, void *us
});
}
+
+const eventcontext_t *timerev_get_ec(const timerev_t *self) {
+ return &self->get_ec();
+}
+
void timerev_free(timerev_t *self) { delete self; }
void timerev_add(timerev_t *self, double t_sec) { self->add(t_sec); }