Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef struct my_work {…} my_work_t;
- dispatch_source_set_event_handler(reader, ^{
- size_t estimate = dispatch_source_get_data(reader);
- my_work_t *work = produce_work_from_input(fd, estimate);
- if (NULL == work)
- dispatch_source_cancel(reader);
- else
- dispatch_async(q_default, ^{ consume_work(work); free(work); } );
- });
- dispatch_resume(reader);
Add Comment
Please, Sign In to add comment