Skip to content

Commit

Permalink
added ks_perform variants that allow the caller to specify run modes
Browse files Browse the repository at this point in the history
  • Loading branch information
samdeane committed Aug 28, 2012
1 parent 07363f8 commit 5b39ea3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions KSThreadProxy.h
Expand Up @@ -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
24 changes: 24 additions & 0 deletions KSThreadProxy.m
Expand Up @@ -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

0 comments on commit 5b39ea3

Please sign in to comment.