Skip to content

Commit 3e307b9

Browse files
Twisted Oak Studios Mac MiniTwisted Oak Studios Mac Mini
Twisted Oak Studios Mac Mini
authored and
Twisted Oak Studios Mac Mini
committed
Documenting
1 parent f53a3dd commit 3e307b9

File tree

1 file changed

+48
-13
lines changed

1 file changed

+48
-13
lines changed

Diff for: src/TOCFutureExtra.h

+48-13
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,62 @@
33

44
@interface TOCFuture (TOCFutureExtra)
55

6-
/// @abstract Returns a future that completes with the value returned by a function run via grand central dispatch.
6+
/*!
7+
* Returns a future that completes with the value returned by a function run via grand central dispatch.
8+
*
9+
* @param operation The operation to eventually evaluate.
10+
*
11+
* @param queue The gcd queue to dispatch the operation on.
12+
*
13+
* @result A future that completes once the operation has been completed, and contains the operation's result.
14+
*/
715
+(TOCFuture*) futureWithResultFromOperation:(id (^)(void))operation
816
dispatchedOnQueue:(dispatch_queue_t)queue;
917

10-
/// @abstract Returns a future that completes with the value returned by a function invoked on the given thread.
11-
/// @param operation The function to run. Must not be nil.
12-
/// @param thread The thread to invoke the function on. Must not be nil.
18+
/*!
19+
* Returns a future that completes with the value returned by a function run on a specified thread.
20+
*
21+
* @param operation The operation to eventually evaluate.
22+
*
23+
* @param thread The thread to perform the operation on.
24+
*
25+
* @result A future that completes once the operation has been completed, and contains the operation's result.
26+
*/
1327
+(TOCFuture*) futureWithResultFromOperation:(id(^)(void))operation
1428
invokedOnThread:(NSThread*)thread;
1529

16-
/// @abstract Returns a future that completes after a given delay (mechanism unspecified [timer, grand central dispatch, whatever]).
17-
/// @param resultValue The result that the future will succeed with after the given delay.
18-
/// @param delay The number of seconds the future is incomplete for.
19-
/// Must not be negative or NaN (raises exception).
20-
/// A delay of 0 results in a future that's already completed.
21-
/// A delay of INFINITY results in a future that's never completed.
22-
+(TOCFuture*) futureWithResult:(id)resultValue
23-
afterDelay:(NSTimeInterval)delay;
24-
30+
/*!
31+
* Returns a future that will contain the given result after the given delay, unless cancelled.
32+
*
33+
* @param resultValue The value the resulting future should complete with, after the delay has passed.
34+
*
35+
* @param delay The amount of time to wait, in seconds, before the resulting future completes.
36+
* Must not be negative or NaN (raises exception).
37+
* A delay of 0 results in a future that's already completed.
38+
* A delay of INFINITY result in an immortal future that never completes.
39+
*
40+
* @param unlessCancelledToken If this token is cancelled before the delay expires, the future immediately fails with the cancel token as its failure.
41+
* Any resources being used for the delay, such as NSTimers, will also be immediately cleaned up upon cancellation.
42+
*
43+
* @result A delayed future result, unless the delay is cancelled.
44+
*/
2545
+(TOCFuture*) futureWithResult:(id)resultValue
2646
afterDelay:(NSTimeInterval)delay
2747
unless:(TOCCancelToken*)unlessCancelledToken;
2848

49+
/*!
50+
* Returns a future that will contain the given result after the given delay.
51+
*
52+
* @param resultValue The value the resulting future should complete with, after the delay has passed.
53+
*
54+
* @param delay The amount of time to wait, in seconds, before the resulting future completes.
55+
* Must not be negative or NaN (raises exception).
56+
* A delay of 0 results in a future that's already completed.
57+
* A delay of INFINITY result in an immortal future that never completes.
58+
*
59+
* @result A delayed future result.
60+
*/
61+
+(TOCFuture*) futureWithResult:(id)resultValue
62+
afterDelay:(NSTimeInterval)delay;
63+
2964
@end

0 commit comments

Comments
 (0)