소스 검색

fix #396: blocking macro conflict with eigen

ithewei 1 년 전
부모
커밋
f0e11406ac
1개의 변경된 파일11개의 추가작업 그리고 3개의 파일을 삭제
  1. 11 3
      base/hsocket.h

+ 11 - 3
base/hsocket.h

@@ -66,13 +66,21 @@ HV_INLINE int nonblocking(int sockfd) {
 
 typedef int     hsocket_t;
 
-#define blocking(s)     fcntl(s, F_SETFL, fcntl(s, F_GETFL) & ~O_NONBLOCK)
-#define nonblocking(s)  fcntl(s, F_SETFL, fcntl(s, F_GETFL) |  O_NONBLOCK)
-
 #ifndef SOCKET
 #define SOCKET int
 #endif
+
+#ifndef INVALID_SOCKET
 #define INVALID_SOCKET  -1
+#endif
+
+HV_INLINE int blocking(int s) {
+    return fcntl(s, F_SETFL, fcntl(s, F_GETFL) & ~O_NONBLOCK);
+}
+
+HV_INLINE int nonblocking(int s) {
+    return fcntl(s, F_SETFL, fcntl(s, F_GETFL) |  O_NONBLOCK);
+}
 
 HV_INLINE int closesocket(int sockfd) {
     return close(sockfd);