Use a thread to start listening and release it when done.

This commit is contained in:
Gregory John Casamento 2020-02-04 06:52:53 -05:00
parent 1c792c3f40
commit e50bfcf35d

View file

@ -174,13 +174,17 @@ static const arg_t cont_args_def[] = {
- (void) startListening
{
[NSThread detachNewThreadSelector: @selector(recognize)
toTarget: self
withObject: nil];
_listeningThread = [[NSThread alloc] initWithTarget: self
selector: @selector(recognize)
object: nil];
[_listeningThread start];
}
- (void) stopListening
{
[_listeningThread cancel];
RELEASE(_listeningThread);
_listeningThread = nil;
}
@end