summaryrefslogtreecommitdiff
path: root/test/pkev.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/pkev.cpp')
-rw-r--r--test/pkev.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/test/pkev.cpp b/test/pkev.cpp
index a34b7d5..ed62803 100644
--- a/test/pkev.cpp
+++ b/test/pkev.cpp
@@ -4,9 +4,7 @@
#include "../pkmacros.h"
#include <csetjmp>
-#include <cstdio>
#include <future>
-#include <thread>
static bool expected_exit = false;
static bool caught = false;
@@ -37,8 +35,14 @@ struct ev ev_two = {};
pk_ev_mgr_id_T
test_setup()
{
- memset(&ev_one, 0, sizeof(struct ev));
- memset(&ev_two, 0, sizeof(struct ev));
+ ev_one.evmgr = {};
+ ev_one.evid = {};
+ ev_one.count = {};
+ ev_one.handled = {};
+ ev_two.evmgr = {};
+ ev_two.evid = {};
+ ev_two.count = {};
+ ev_two.handled = {};
pk_ev_init();
const pk_ev_mgr_id_T evmgr = pk_ev_create_mgr();
if (evmgr >= 64) {
@@ -100,8 +104,12 @@ int main(int argc, char *argv[])
ev_two.evid = pk_ev_register_ev(evmgr, NULL);
pk_ev_register_cb(evmgr, ev_one.evid, &invoke_packged_task, NULL);
pk_ev_register_cb(evmgr, ev_two.evid, &invoke_packged_task, NULL);
- auto t1 = std::thread([&handle_ev_one]() { pk_ev_emit(ev_one.evmgr, ev_one.evid, &handle_ev_one); });
- auto t2 = std::thread([&handle_ev_two]() { pk_ev_emit(ev_two.evmgr, ev_two.evid, &handle_ev_two); });
+ std::thread t1 = std::thread([&]() {
+ pk_ev_emit(ev_one.evmgr, ev_one.evid, &handle_ev_one);
+ });
+ std::thread t2 = std::thread([&]() {
+ pk_ev_emit(ev_two.evmgr, ev_two.evid, &handle_ev_two);
+ });
t1.join();
t2.join();
PK_LOGV_INF("%s: ev_one: %s, ev_two: %s\n", __FILE__, ev_one.handled ? "true" : "false", ev_two.handled ? "true" : "false");