Created
February 23, 2009 23:08
-
-
Save stevestreza/69247 to your computer and use it in GitHub Desktop.
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
25d24 | |
> -(void)setSuspended:(BOOL)suspended; |
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
23a24,25 | |
> | |
> BOOL _suspended; | |
28a31 | |
> - (void)setSuspended:(BOOL)suspended; | |
37a41 | |
> _suspended = NO; | |
40,41c44 | |
< _thread = [[NSThread alloc] initWithTarget: self selector: @selector( _workThread ) object: nil]; | |
< [_thread start]; | |
--- | |
> [self _setupThread]; | |
67c70,72 | |
< [_trigger signal]; | |
--- | |
> | |
> if(!_suspended) | |
> [_trigger signal]; | |
80,81c85,108 | |
< - (void)stop | |
< { | |
--- | |
> -(void)setSuspended:(BOOL)suspended{ | |
> BOOL needsSignal = (_suspended && !suspended); // if it was suspended, and is not now | |
> BOOL needsSuspend = (!_suspended && suspended); | |
> _suspended = suspended; | |
> | |
> if(needsSignal){ | |
> if([_thread isCancelled]){ | |
> [self _setupThread]; | |
> } | |
> [_trigger signal]; | |
> }else if(needsSuspend){ | |
> [self stop]; | |
> } | |
> } | |
> | |
> -(void)_setupThread{ | |
> [_thread release]; | |
> | |
> _thread = [[NSThread alloc] initWithTarget: self selector: @selector( _workThread ) object: nil]; | |
> [_thread start]; | |
> } | |
> | |
> - (void)stop{ | |
> | |
181a209,212 | |
> -(void)setSuspended:(BOOL)suspended{ | |
> [_impl setSuspended:suspended]; | |
> } | |
> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment