From: Jeffrey Altman Date: Tue, 25 Dec 2007 22:59:06 +0000 (+0000) Subject: rx-event-handler-20071225 X-Git-Tag: BP-openafs-windows-kdfs-ifs~265 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=6b1537b246732e4f7f67661d8230d051db8f3f8d rx-event-handler-20071225 LICENSE MIT Update event_handler() for Windows. The return code of pthread_cond_timedwait() is not limited to 0 and -1 because 'errno' cannot be set. Instead of setting 'errno' the error code is returned directly by the function as the return code. This patch is only for debugging purposes to track the number of success, timeout, and other errors experienced by the routine. --- diff --git a/src/rx/rx_pthread.c b/src/rx/rx_pthread.c index d633475..0a14c0f 100644 --- a/src/rx/rx_pthread.c +++ b/src/rx/rx_pthread.c @@ -146,7 +146,9 @@ event_handler(void *argp) unsigned long rx_pthread_n_event_expired = 0; unsigned long rx_pthread_n_event_waits = 0; long rx_pthread_n_event_woken = 0; + unsigned long rx_pthread_n_event_error = 0; struct timespec rx_pthread_next_event_time = { 0, 0 }; + int error; assert(pthread_mutex_lock(&event_handler_mutex) == 0); @@ -171,16 +173,25 @@ event_handler(void *argp) rx_pthread_next_event_time.tv_sec = cv.sec; rx_pthread_next_event_time.tv_nsec = cv.usec * 1000; rx_pthread_n_event_waits++; - if (pthread_cond_timedwait + error = pthread_cond_timedwait (&rx_event_handler_cond, &event_handler_mutex, - &rx_pthread_next_event_time) == -1) { -#ifdef notdef - assert(errno == EAGAIN); -#endif + &rx_pthread_next_event_time); + if (error == 0) { + rx_pthread_n_event_woken++; + } +#ifdef AFS_NT40_ENV + else if (error == ETIMEDOUT) { rx_pthread_n_event_expired++; } else { - rx_pthread_n_event_woken++; - } + rx_pthread_n_event_error++; + } +#else + else if (errno == ETIMEDOUT) { + rx_pthread_n_event_expired++; + } else { + rx_pthread_n_event_error++; + } +#endif rx_pthread_event_rescheduled = 0; } }