Linux-Semaphore

1. Made a similar change for Linux semaphores.
2. Moved the check for the quit flag in the windowMonitor.
pull/580/head
John Safranek 2023-09-14 16:46:06 -07:00
parent 503e1bb288
commit 526ade03df
No known key found for this signature in database
GPG Key ID: 8CE817DE0D3CCB4A
1 changed files with 7 additions and 3 deletions

View File

@ -254,12 +254,12 @@ static THREAD_RET windowMonitor(void* in)
do {
#if (defined(__OSX__) || defined(__APPLE__))
dispatch_semaphore_wait(windowSem, DISPATCH_TIME_FOREVER);
if (args->quit) {
break;
}
#else
sem_wait(&windowSem);
#endif
if (args->quit) {
break;
}
ret = sendCurrentWindowSize(args);
(void)ret;
} while (1);
@ -895,7 +895,11 @@ THREAD_RETURN WOLFSSH_THREAD client_test(void* args)
pthread_join(thread[2], NULL);
/* Wake the windowMonitor thread so it can exit. */
arg.quit = 1;
#if (defined(__OSX__) || defined(__APPLE__))
dispatch_semaphore_signal(windowSem);
#else
sem_post(&windowSem);
#endif
pthread_join(thread[0], NULL);
pthread_cancel(thread[1]);
#if (defined(__OSX__) || defined(__APPLE__))