-
Notifications
You must be signed in to change notification settings - Fork 576
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+[BFTask taskFromExecutor:withBlock] to easily create ad-hoc tasks
This convenience class method makes it easier to create tasks from blocks without needing to write the code for a temporary `BFTask` or `BFTaskCompletionSource`. Usage: [[BFTask taskFromExecutor:executor withBlock:id ^{ return work_on_queue(); }] continueWithBlock:...]; As opposed to: BFTaskCompletionSource *tcs = [BFTaskCompletionSource taskCompletionSource]; dispatch_async(queue, ^{ [tcs setResult:work_on_queue()]; }); [tcs.task continueWithBlock:...]; The convenience method also handles exceptions the same way the rest of BFTasks does so that's another plus. Test case is included.
- Loading branch information
Showing
3 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters