no actions if controls thread tid2 is not set

This commit is contained in:
Holger Vogt 2019-09-25 22:29:37 +02:00
parent fa0fc7f131
commit 840d00c4ca
1 changed files with 12 additions and 8 deletions

View File

@ -346,7 +346,8 @@ _cthread_run(void *controls)
return NULL;
}
/* starts a background thread, e.g. from command bg_run */
/* starts a background thread, e.g. from command bg_run,
releases controls thread tid2 */
static void * EXPORT_FLAVOR
_thread_run(void *string)
{
@ -368,18 +369,21 @@ _thread_run(void *string)
/* notify caller that thread has exited */
if (!nobgtrwanted)
bgtr(fl_exited, ng_ident, userptr);
/* release thread tid2 */
if (tid2) {
#ifdef HAVE_LIBPTHREAD
pthread_mutex_lock(&triggerMutex);
cont_condition = TRUE;
pthread_cond_signal(&cond);
pthread_mutex_unlock(&triggerMutex);
pthread_join(tid2, NULL);
pthread_mutex_lock(&triggerMutex);
cont_condition = TRUE;
pthread_cond_signal(&cond);
pthread_mutex_unlock(&triggerMutex);
pthread_join(tid2, NULL);
#elif defined _MSC_VER || defined __MINGW32__
ResumeThread(tid2);
ResumeThread(tid2);
#else
#endif
tid2 = 0;
}
return NULL;
}