Permalink
Browse files

Futures accept cleanup blocks, called on cancellation or completion.

  • Loading branch information...
1 parent b102c9d commit afdf7d55665c7c7d501a6b95803094231deb9588 @robrix committed Feb 14, 2012
Showing with 8 additions and 0 deletions.
  1. +2 −0 RXFutures/RXFuture.h
  2. +6 −0 RXFutures/RXFuture.m
View
@@ -23,6 +23,8 @@
-(void)cancel;
-(void)cancel:(void(^)())block; // shorthand for -onCancel: followed by -cancel
+-(void)onCleanUp:(void(^)())block; // performed on completion or cancellation
+
-(void)performBlock:(void(^)())block;
-(void)unlessCancelled:(void(^)())block;
View
@@ -97,6 +97,12 @@ -(void)complete:(void(^)())block {
}
+-(void)onCleanUp:(void(^)())block {
+ [self onComplete:block];
+ [self onCancel:block];
+}
+
+
-(void)performBlock:(void(^)())block {
dispatch_async(queue, block);
}

0 comments on commit afdf7d5

Please sign in to comment.