|
|
| 80 |
|
80 |
|
| 81 |
#include <errno.h> |
81 |
#include <errno.h> |
| 82 |
#include <signal.h> |
82 |
#include <signal.h> |
| |
83 |
#ifndef HAVE_CLOCK_GETTIME |
| |
84 |
#include <sys/time.h> |
| |
85 |
#endif |
| 83 |
#include <time.h> |
86 |
#include <time.h> |
| 84 |
#include "threadpool.h" |
87 |
#include "threadpool.h" |
| 85 |
#include "utils.h" |
88 |
#include "utils.h" |
|
|
| 208 |
tp_work_t *mywork; |
211 |
tp_work_t *mywork; |
| 209 |
tp_working_t working; |
212 |
tp_working_t working; |
| 210 |
|
213 |
|
| |
214 |
#ifndef HAVE_CLOCK_GETTIME |
| |
215 |
struct timeval tv; |
| |
216 |
#endif |
| 211 |
struct timespec ts; |
217 |
struct timespec ts; |
| 212 |
|
218 |
|
| 213 |
if (request_pool == NULL) |
219 |
if (request_pool == NULL) |
|
|
| 243 |
} |
249 |
} |
| 244 |
else |
250 |
else |
| 245 |
{ |
251 |
{ |
| |
252 |
#ifndef HAVE_CLOCK_GETTIME |
| |
253 |
gettimeofday(&tv, NULL); |
| |
254 |
ts.tv_sec = tv.tv_sec; |
| |
255 |
ts.tv_nsec = 0; |
| |
256 |
#else |
| 246 |
clock_gettime(CLOCK_REALTIME,&ts); |
257 |
clock_gettime(CLOCK_REALTIME,&ts); |
| |
258 |
#endif |
| 247 |
ts.tv_sec += request_pool->tp_max_idle_secs; |
259 |
ts.tv_sec += request_pool->tp_max_idle_secs; |
| 248 |
rc = pthread_cond_timedwait(&request_pool->tp_waiting_work,&request_pool->tp_mutex,&ts); |
260 |
rc = pthread_cond_timedwait(&request_pool->tp_waiting_work,&request_pool->tp_mutex,&ts); |
| 249 |
|
261 |
|