aboutsummaryrefslogtreecommitdiff
path: root/src/event.cpp
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2019-06-28 17:10:36 -0400
committerDeterminant <[email protected]>2019-06-28 17:10:36 -0400
commitfedfeaced48150e27907628244e95ca54dbe7c02 (patch)
tree40643888f7f1fe4ddfe75f777c7dddd5c276feb9 /src/event.cpp
parent06b5a84602dc6a5dd76d82c9f88359cdb8cf52da (diff)
more api
Diffstat (limited to 'src/event.cpp')
-rw-r--r--src/event.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/event.cpp b/src/event.cpp
index 2fe2861..18aca18 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -69,6 +69,30 @@ void timerev_del(timerev_t *self) { self->del(); }
void timerev_clear(timerev_t *self) { self->clear(); }
+mpscqueue_t *mpscqueue_new() { return new mpscqueue_t(); }
+
+void mpscqueue_free(mpscqueue_t *self) { delete self; }
+
+void mpscqueue_reg_handler(mpscqueue_t *self, const eventcontext_t *ec, mpscqueue_callback_t callback, void *userdata) {
+ self->reg_handler(*ec, [=](mpscqueue_t &q) {
+ return callback(&q, userdata);
+ });
+}
+
+void mpscqueue_unreg_handler(mpscqueue_t *self) { self->unreg_handler(); }
+
+bool mpscqueue_enqueue(mpscqueue_t *self, void *elem, bool unbounded) {
+ return self->enqueue(elem, unbounded);
+}
+
+bool mpscqueue_try_dequeue(mpscqueue_t *self, void **elem) {
+ return self->try_dequeue(*elem);
+}
+
+void mpscqueue_set_capacity(mpscqueue_t *self, size_t cap) {
+ self->set_capacity(cap);
+}
+
}
#endif