change status signal place

This commit is contained in:
springzfx
2020-05-30 01:59:24 +08:00
parent dfc688b5e5
commit 34e5d81329
4 changed files with 11 additions and 7 deletions

View File

@@ -48,6 +48,7 @@ struct data_t {
};
function<int(int)> callback = NULL;
promise<void> status;
void handle_events(void *cb_cookie, void *data, int data_size) {
auto event = static_cast<data_t *>(data);
@@ -91,13 +92,15 @@ int execsnoop() {
return 1;
}
status.set_value();
while (true) bpf.poll_perf_buffer("events");
return 0;
}
void startThread(function<int(int)> c, promise<void> status) {
status.set_value();
void startThread(function<int(int)> c, promise<void> _status) {
status = move(_status);
callback = c;
execsnoop();
}