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