3 ms·
libdispatch is more than just programs submitting blocks to queues – dispatch sources and event handlers can handle channels of asynchronous input as well.
by koko775 11y ago
libdispatch is more than just programs submitting blocks to queues – dispatch sources and event handlers can handle channels of asynchronous input as well.
- sunnyps 11y agoI forgot about that part of libdispatch. You still can't do synchronous IO but you can use libdispatch semaphores, wait on a queue, etc. and that should not block the thread, right?
- koko775 11y agoThe docs offer different kinds of sources for automatically enqueueing blocks: #define DISPATCH_SOURCE_TYPE_DATA_ADD #define DISPATCH_SOURCE_TYPE_DATA_OR #define DISPATCH_SOURCE_TYPE_MACH_RECV #define DISPATCH_SOURCE_TYPE_MACH_SEND #define DISPATCH_SOURCE_TYPE_PROC #define DISPATCH_SOURCE_TYPE_READ #define DISPATCH_SOURCE_TYPE_SIGNAL #define DISPATCH_SOURCE_TYPE_TIMER #define DISPATCH_SOURCE_TYPE_VNODE #define DISPATCH_SOURCE_TYPE_WRITE #define DISPATCH_SOURCE_TYPE_MEMORYPRESSURE