5 ms·
I've built systems with libdispatch and blocks. I found it much nicer than traditional C style non-blocking IO or typical pthreads, both of which I have also do
by jws 11y ago
I've built systems with libdispatch and blocks. I found it much nicer than traditional C style non-blocking IO or typical pthreads, both of which I have also done.
• You don't need to use blocks, there are function callback versions of the calls available, but blocks are nicer.
• There are asynchronous IO routines, that covers most of your stalls.
• Go probably stalls threads on page faults, as does libdispatch.
You can read about the Linux port of libdispatch at https://github.com/nickhutchinson/libdispatch https://github.com/nickhutchinson/libdispatch
- stefantalpalaru 11y agoIt looks like the Linux port of libdispatch uses OS threads through pthreads, so it's not a candidate for the user space light-weight threads needed for efficient CSP.
- jws 11y agoI'm fairly certain that is just to get the worker pool. The blocks on the queue don't each get a thread.