diff options
author | Determinant <tederminant@gmail.com> | 2019-06-12 19:14:40 -0400 |
---|---|---|
committer | Determinant <tederminant@gmail.com> | 2019-06-12 19:14:40 -0400 |
commit | e27e529e589ef89fbe010ebf7c5635ec2873f64f (patch) | |
tree | 76e7d20589d11f3aabd255ca70201f1288d1d1bc /include/salticidae/event.h | |
parent | 9f6460c7ab774d900f391345bbf3fac8617a3aa3 (diff) |
WIP: error handling
Diffstat (limited to 'include/salticidae/event.h')
-rw-r--r-- | include/salticidae/event.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/include/salticidae/event.h b/include/salticidae/event.h index 91637e4..5a315dd 100644 --- a/include/salticidae/event.h +++ b/include/salticidae/event.h @@ -467,8 +467,14 @@ class MPSCQueueEventDriven: public MPSCQueue<T> { // since all enqueue operations are finalized, the dequeue should be able // to see those enqueued values in func() wait_sig.exchange(true, std::memory_order_acq_rel); - if (func(*this)) + bool again; + try { + again = func(*this); + } catch (SalticidaeError &err) { write(fd, &dummy, 8); + throw err; + } + if (again) write(fd, &dummy, 8); }); ev.add(FdEvent::READ); } @@ -610,7 +616,12 @@ class ThreadCall { Handle *h; while (q.try_dequeue(h)) { - h->exec(); + try { + h->exec(); + } catch (SalticidaeError &err) { + delete h; + throw err; + } delete h; if (++cnt == burst_size) return true; } |