Re:Libdill: Structured Concurrency for C (2016)
by Peaker on Thursday December 21, 2017 @02:56PM
(#15982257)
We use D fibers. When we want to cancel a fiber we throw an exception at it. When it next wakes up, it'll throw (much like sending an exception to a Python generator) -- which will make sure RAII cleanups take place and are not missed.
[ Parent
| on HN ]
Re:Libdill: Structured Concurrency for C (2016)
by aidenn0 on Thursday December 21, 2017 @08:11PM
(#15984489)
Getting that right at the implementation level is quite hard; it also requires support at the OS level that isn't always there (e.g. interrupting a blocking system call).
Re:Libdill: Structured Concurrency for C (2016)
by Peaker on Sunday December 24, 2017 @11:53AM
(#16000225)
Then avoid blocking system calls.
When you can't, defer them to a thread that can be ignored.
Re:Libdill: Structured Concurrency for C (2016)
by aidenn0 on Wednesday December 27, 2017 @04:12PM
(#16018080)
That's a huge footgun in an environment where blocking calls are the default way to get almost anything done, and some calls cannot be made non-blocking.