Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added ks_perform variants that allow the caller to specify run modes

  • Loading branch information...
commit 5b39ea30e130c5ca0d1bac1ead4c57e4a0ee40f5 1 parent 07363f8
@samdeane samdeane authored
Showing with 32 additions and 0 deletions.
  1. +8 −0 KSThreadProxy.h
  2. +24 −0 KSThreadProxy.m
View
8 KSThreadProxy.h
@@ -59,5 +59,13 @@
- (void)ks_performBlock:(void (^)())block;
- (void)ks_performBlockAndWait:(void (^)())block;
+// As above, but allowing the caller to specify the run mode to run on.
+- (void)ks_performUsingMode:(NSString*)mode block:(void (^)(void))block;
+- (void)ks_performAndWaitUsingMode:(NSString*)mode block:(void (^)(void))block;
+
+// As above, but allowing multiple run modes
+- (void)ks_performUsingModes:(NSArray*)modes block:(void (^)(void))block;
+- (void)ks_performAndWaitUsingModes:(NSArray*)modes block:(void (^)(void))block;
+
@end
#endif
View
24 KSThreadProxy.m
@@ -162,6 +162,30 @@ - (void)ks_performBlockAndWait:(void (^)())block;
[block performSelector:@selector(invoke) onThread:self withObject:nil waitUntilDone:YES];
}
+- (void)ks_performUsingMode:(NSString*)mode block:(void (^)(void))block
+{
+ block = [block copy];
+ [block performSelector:@selector(invoke) onThread:self withObject:nil waitUntilDone:NO modes:[NSArray arrayWithObject:mode]];
+ [block release];
+}
+
+- (void)ks_performAndWaitUsingMode:(NSString*)mode block:(void (^)(void))block
+{
+ [block performSelector:@selector(invoke) onThread:self withObject:nil waitUntilDone:YES modes:[NSArray arrayWithObject:mode]];
+}
+
+- (void)ks_performUsingModes:(NSArray*)modes block:(void (^)(void))block
+{
+ block = [block copy];
+ [block performSelector:@selector(invoke) onThread:self withObject:nil waitUntilDone:NO modes:modes];
+ [block release];
+}
+
+- (void)ks_performAndWaitUsingModes:(NSArray*)modes block:(void (^)(void))block
+{
+ [block performSelector:@selector(invoke) onThread:self withObject:nil waitUntilDone:YES modes:modes];
+}
+
@end
#endif
Please sign in to comment.
Something went wrong with that request. Please try again.