1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-09 14:28:12 +00:00

Create an OS specific sock_blocks function.

This commit is contained in:
Con Kolivas 2013-04-24 23:05:44 +10:00
parent 181cb1635f
commit a2a7a036f0

8
util.h
View File

@ -14,6 +14,10 @@
#define CLOSESOCKET close #define CLOSESOCKET close
#define SOCKERRMSG strerror(errno) #define SOCKERRMSG strerror(errno)
static inline bool sock_blocks(void)
{
return (errno == EAGAIN || errno == EWOULDBLOCK);
}
#elif defined WIN32 #elif defined WIN32
#include <ws2tcpip.h> #include <ws2tcpip.h>
#include <winsock2.h> #include <winsock2.h>
@ -27,6 +31,10 @@
extern char *WSAErrorMsg(void); extern char *WSAErrorMsg(void);
#define SOCKERRMSG WSAErrorMsg() #define SOCKERRMSG WSAErrorMsg()
static inline bool sock_blocks(void)
{
return (WSAGetLastError() == WSAEWOULDBLOCK);
}
#ifndef SHUT_RDWR #ifndef SHUT_RDWR
#define SHUT_RDWR SD_BOTH #define SHUT_RDWR SD_BOTH
#endif #endif