mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 17:52:42 +00:00
Stop thread properly and close utterance.
This commit is contained in:
parent
07bf3d32e4
commit
f05702d450
2 changed files with 7 additions and 3 deletions
|
@ -89,7 +89,7 @@ BOOL _serverLaunchTested = NO;
|
|||
unsigned int i = 0;
|
||||
|
||||
// Wait for up to five seconds for the server to launch, then give up.
|
||||
for (i=0 ; i < 50 ; i++)
|
||||
for (i = 0 ; i < 50 ; i++)
|
||||
{
|
||||
_speechRecognitionServer = [NSConnection
|
||||
rootProxyForConnectionWithRegisteredName: SPEECH_RECOGNITION_SERVER
|
||||
|
|
|
@ -149,9 +149,9 @@ static const arg_t cont_args_def[] = {
|
|||
}
|
||||
|
||||
utt_started = NO;
|
||||
NSLog(@"Ready....");
|
||||
NSLog(@"Ready.... <%@, %d>", _listeningThread, [_listeningThread isCancelled]);
|
||||
|
||||
while([_listeningThread isCancelled] == NO)
|
||||
while([_listeningThread isCancelled] == NO && _listeningThread != nil)
|
||||
{
|
||||
if ((k = ad_read(ad, adbuf, 2048)) < 0)
|
||||
{
|
||||
|
@ -193,6 +193,9 @@ static const arg_t cont_args_def[] = {
|
|||
}
|
||||
[NSThread sleepForTimeInterval: 0.01];
|
||||
}
|
||||
|
||||
// Close everything...
|
||||
ps_end_utt(ps);
|
||||
ad_close(ad);
|
||||
}
|
||||
|
||||
|
@ -202,6 +205,7 @@ static const arg_t cont_args_def[] = {
|
|||
[[NSThread alloc] initWithTarget: self
|
||||
selector: @selector(recognize)
|
||||
object: nil];
|
||||
[_listeningThread setName: @"Speech Recognition Loop"];
|
||||
NSLog(@"Thread info for speech reconigtion server %@", _listeningThread);
|
||||
[_listeningThread start];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue