Commit 3c69d12
committed
Merge #260: event loop: tolerate unexpected exceptions in
b8a48c6 event loop: tolerate unexpected exceptions in `post()` callbacks (hulxv)
Pull request description:
If a function posted via `EventLoop::post()` threw an exception, the event loop would exit without resetting `m_post_fn` or notifying the condition variable, permanently deadlocking the calling thread in `post()`.
This change catches the exception instead, logs it, and keeps the event loop running so the caller is unblocked and other I/O events continue to be processed.
Fix #259
ACKs for top commit:
ryanofsky:
Code review ACK b8a48c6. Since last review just squashed commits and added missing thread safety annotation. This change is a probably an improvement from a debugging perspective since it will now always log an error when an unexpected exception happens. It is not a clear improvement in behavior since continuing after an unexpected failure could potentially be worse than hanging, but the difference is unlikely to be significant. Probably the best thing would be to [catch and rethrow](#260 (comment)) the exception.
Tree-SHA512: 5cf5481227b810ce09801eebf6bcde44ee3152545738cbd8068365a2d988ddd78486cc08906e0df3125be83f06acb0ae40e718c3b1d28c602e821ae1989c317epost() callbacks1 file changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
245 | 246 | | |
246 | 247 | | |
247 | 248 | | |
248 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
249 | 255 | | |
250 | 256 | | |
251 | 257 | | |
| |||
0 commit comments