Terminate thread also when zm_terminate is true

This commit is contained in:
Isaac Connor 2020-12-09 12:21:31 -05:00
parent a3ff81b279
commit 697f9a50fe
1 changed files with 3 additions and 3 deletions

View File

@ -25,7 +25,7 @@ int AnalysisThread::run() {
monitor->get_ref_image(); monitor->get_ref_image();
Debug(2, "THREAD: after Getting ref image"); Debug(2, "THREAD: after Getting ref image");
while ( !terminate ) { while ( !(terminate or zm_terminate) ) {
// Process the next image // Process the next image
//sigprocmask(SIG_BLOCK, &block_set, 0); //sigprocmask(SIG_BLOCK, &block_set, 0);
@ -41,10 +41,10 @@ int AnalysisThread::run() {
Debug(2, "Analyzing"); Debug(2, "Analyzing");
if ( !monitor->Analyse() ) { if ( !monitor->Analyse() ) {
Debug(2, "Sleeping for %d", monitor->Active()?ZM_SAMPLE_RATE:ZM_SUSPENDED_RATE); Debug(2, "uSleeping for %d", 10*(monitor->Active()?ZM_SAMPLE_RATE:ZM_SUSPENDED_RATE));
usleep(10*(monitor->Active()?ZM_SAMPLE_RATE:ZM_SUSPENDED_RATE)); usleep(10*(monitor->Active()?ZM_SAMPLE_RATE:ZM_SUSPENDED_RATE));
} else if ( analysis_rate ) { } else if ( analysis_rate ) {
Debug(2, "Sleeping for %d", analysis_rate); Debug(2, "uSleeping for %d", analysis_rate);
usleep(analysis_rate); usleep(analysis_rate);
} else { } else {
Debug(2, "Not Sleeping"); Debug(2, "Not Sleeping");