1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-29 16:04:33 +00:00

Check for correct timeout error in cgsem_mswait

This commit is contained in:
Con Kolivas 2013-10-14 11:34:08 +11:00
parent 51f8107b32
commit 6e948d8750
2 changed files with 9 additions and 1 deletions

2
util.c
View File

@ -2472,7 +2472,7 @@ int _cgsem_mswait(cgsem_t *cgsem, int ms, const char *file, const char *func, co
timeraddspec(&abs_timeout, &ts_now);
ret = sem_timedwait(cgsem, &abs_timeout);
if (unlikely(ret && ret != ETIMEDOUT))
if (unlikely(ret && !sock_timeout()))
quitfrom(1, file, func, line, "Failed to sem_timedwait errno=%d cgsem=0x%p", errno, cgsem);
return ret;
}

8
util.h
View File

@ -20,6 +20,10 @@
{
return (errno == EAGAIN || errno == EWOULDBLOCK);
}
static inline bool sock_timeout(void)
{
return (errno == ETIMEDOUT);
}
#elif defined WIN32
#include <ws2tcpip.h>
#include <winsock2.h>
@ -37,6 +41,10 @@
{
return (WSAGetLastError() == WSAEWOULDBLOCK);
}
static inline bool sock_timeout(void)
{
return (WSAGetLastError() == WSAETIMEDOUT);
}
#ifndef SHUT_RDWR
#define SHUT_RDWR SD_BOTH
#endif