b24c2a743b181481454816222301d0b832b5ccc9 angie Fri Oct 28 15:11:02 2022 -0700 Add pthreadJoin for getting a thread worker function's return value. diff --git src/inc/pthreadWrap.h src/inc/pthreadWrap.h index 5021bb4..3430d1f 100644 --- src/inc/pthreadWrap.h +++ src/inc/pthreadWrap.h @@ -4,30 +4,33 @@ * the program is hosed. */ #ifndef PTHREADWRAP_H #define PTHREADWRAP_H #include <pthread.h> void pthreadCreate(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg); /* Create a thread or squawk and die. */ boolean pthreadMayCreate(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg); /* Create a thread. Warn and return FALSE if there is a problem. */ +void pthreadJoin(pthread_t *thread, void **retVal); +/* Wait for thread to complete and optionally get its return value, or die. */ + void pthreadMutexInit(pthread_mutex_t *mutex); /* Initialize mutex or die trying */ void pthreadMutexDestroy(pthread_mutex_t *mutex); /* Free up mutex. */ void pthreadMutexLock(pthread_mutex_t *mutex); /* Lock a mutex to gain exclusive access or die trying. */ void pthreadMutexUnlock(pthread_mutex_t *mutex); /* Unlock a mutex or die trying. */ void pthreadCondInit(pthread_cond_t *cond); /* Initialize pthread conditional. */