diff options
Diffstat (limited to 'cups/thread.c')
-rw-r--r-- | cups/thread.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/cups/thread.c b/cups/thread.c index 65257aa1..7ffc2ec0 100644 --- a/cups/thread.c +++ b/cups/thread.c @@ -1,7 +1,7 @@ /* * Threading primitives for CUPS. * - * Copyright 2009-2017 by Apple Inc. + * Copyright © 2009-2018 by Apple Inc. * * These coded instructions, statements, and computer programs are the * property of Apple Inc. and are protected by Federal copyright @@ -56,8 +56,16 @@ _cupsCondWait(_cups_cond_t *cond, /* I - Condition */ { struct timespec abstime; /* Timeout */ - abstime.tv_sec = (long)timeout; - abstime.tv_nsec = (long)(1000000000 * (timeout - (long)timeout)); + clock_gettime(CLOCK_REALTIME, &abstime); + + abstime.tv_sec += (long)timeout; + abstime.tv_nsec += (long)(1000000000 * (timeout - (long)timeout)); + + while (abstime.tv_nsec >= 1000000000) + { + abstime.tv_nsec -= 1000000000; + abstime.tv_sec ++; + }; pthread_cond_timedwait(cond, mutex, &abstime); } @@ -200,7 +208,7 @@ _cupsThreadWait(_cups_thread_t thread) /* I - Thread ID */ } -#elif defined(WIN32) +#elif defined(_WIN32) # include <process.h> @@ -513,8 +521,7 @@ _cupsThreadCreate( _cups_thread_func_t func, /* I - Entry point */ void *arg) /* I - Entry point context */ { - fputs("DEBUG: CUPS was compiled without threading support, no thread " - "created.\n", stderr); + fputs("DEBUG: CUPS was compiled without threading support, no thread created.\n", stderr); (void)func; (void)arg; @@ -524,6 +531,17 @@ _cupsThreadCreate( /* + * '_cupsThreadDetach()' - Tell the OS that the thread is running independently. + */ + +void +_cupsThreadDetach(_cups_thread_t thread)/* I - Thread ID */ +{ + (void)thread; +} + + +/* * '_cupsThreadWait()' - Wait for a thread to exit. */ |