|
|
@ -2579,14 +2579,11 @@ int _cgsem_mswait(cgsem_t *cgsem, int ms, const char *file, const char *func, co |
|
|
|
ret = read(fd, &buf, 1); |
|
|
|
ret = read(fd, &buf, 1); |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (likely(!ret)) |
|
|
|
/* Harmless to time out regardless here since we may be waiting on sems
|
|
|
|
return ETIMEDOUT; |
|
|
|
* during shutdown. */ |
|
|
|
quitfrom(1, file, func, line, "Failed to sem_timedwait errno=%d cgsem=0x%p", errno, cgsem); |
|
|
|
if (unlikely(ret)) { |
|
|
|
/* We don't reach here */ |
|
|
|
applog(LOG_WARNING, "Failed to sem_timedwait %s %s %d errno=%d cgsem=0x%p", |
|
|
|
return 0; |
|
|
|
file, func, line, errno, cgsem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return ETIMEDOUT; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
#else |
|
|
|
#else |
|
|
|
void _cgsem_init(cgsem_t *cgsem, const char *file, const char *func, const int line) |
|
|
|
void _cgsem_init(cgsem_t *cgsem, const char *file, const char *func, const int line) |
|
|
@ -2620,13 +2617,12 @@ int _cgsem_mswait(cgsem_t *cgsem, int ms, const char *file, const char *func, co |
|
|
|
timeraddspec(&abs_timeout, &ts_now); |
|
|
|
timeraddspec(&abs_timeout, &ts_now); |
|
|
|
ret = sem_timedwait(cgsem, &abs_timeout); |
|
|
|
ret = sem_timedwait(cgsem, &abs_timeout); |
|
|
|
|
|
|
|
|
|
|
|
/* Harmless to time out regardless here since we may be waiting on sems
|
|
|
|
if (ret) { |
|
|
|
* during shutdown. */ |
|
|
|
if (likely(sock_timeout())) |
|
|
|
if (unlikely(ret && !sock_timeout())) { |
|
|
|
return ETIMEDOUT; |
|
|
|
applog(LOG_WARNING, "Failed to sem_timedwait %s %s %d errno=%d cgsem=0x%p", |
|
|
|
quitfrom(1, file, func, line, "Failed to sem_timedwait errno=%d cgsem=0x%p", errno, cgsem); |
|
|
|
file, func, line, errno, cgsem); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return ETIMEDOUT; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void cgsem_destroy(cgsem_t *cgsem) |
|
|
|
void cgsem_destroy(cgsem_t *cgsem) |
|
|
|