Restoring the ability to compile without IOCP. To do so remove the WIN32_IOCP definition in the C/C++\Preporcessor\Preprocessor Definitions in all projects. Performance is 30-40% better with IOCP.
This commit is contained in:
@@ -83,7 +83,7 @@
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;USE_DL_PREFIX;LACKS_STDLIB_H;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);NO_QFORKIMPL;WIN32_IOCP</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32_IOCP;WIN32;USE_DL_PREFIX;LACKS_STDLIB_H;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);NO_QFORKIMPL</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\deps\lua\src</AdditionalIncludeDirectories>
|
||||
@@ -119,13 +119,14 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;USE_DL_PREFIX;LACKS_STDLIB_H;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);WIN32_IOCP;WIN32_IOCP;NO_QFORKIMPL</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32_IOCP;WIN32;USE_DL_PREFIX;LACKS_STDLIB_H;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);NO_QFORKIMPL</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\deps\lua\src</AdditionalIncludeDirectories>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\deps\hiredis;$(SolutionDir)..\deps\linenoise;$(SolutionDir)..\deps\lua\src</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;USE_DL_PREFIX;LACKS_STDLIB_H;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);NO_QFORKIMPL;WIN32_IOCP</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32_IOCP;WIN32;USE_DL_PREFIX;LACKS_STDLIB_H;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);NO_QFORKIMPL</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
@@ -121,13 +121,14 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\deps\hiredis;$(SolutionDir)..\deps\linenoise;$(SolutionDir)..\deps\lua\src</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;USE_DL_PREFIX;LACKS_STDLIB_H;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);WIN32_IOCP;WIN32_IOCP;NO_QFORKIMPL</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32_IOCP;WIN32;USE_DL_PREFIX;LACKS_STDLIB_H;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);NO_QFORKIMPL</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;USE_DL_PREFIX;LACKS_STDLIB_H;_DEBUG;_CONSOLE;__x86_64__;%(PreprocessorDefinitions);USE_DLMALLOC;WIN32_IOCP</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32_IOCP;WIN32;USE_DL_PREFIX;LACKS_STDLIB_H;_DEBUG;_CONSOLE;__x86_64__;%(PreprocessorDefinitions);USE_DLMALLOC</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\deps\lua\src;$(SolutionDir)..\deps\hiredis</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
@@ -126,13 +126,14 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>_WIN32IOCP;WIN32;USE_DL_PREFIX;LACKS_STDLIB_H;NDEBUG;_CONSOLE;__x86_64__;%(PreprocessorDefinitions);WIN32_IOCP;USE_DLMALLOC</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32_IOCP;WIN32;USE_DL_PREFIX;LACKS_STDLIB_H;NDEBUG;_CONSOLE;__x86_64__;%(PreprocessorDefinitions);USE_DLMALLOC</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\deps\lua\src;$(SolutionDir)..\deps\hiredis</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4996;4146</DisableSpecificWarnings>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<Optimization>Full</Optimization>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions);WIN32_IOCP</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32_IOCP;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
@@ -110,12 +110,13 @@
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions);WIN32_IOCP;WIN32_IOCP</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32_IOCP;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions);WIN32_IOCP</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32_IOCP;WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<DisableSpecificWarnings>4244;4018</DisableSpecificWarnings>
|
||||
@@ -118,10 +118,12 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions);WIN32_IOCP;WIN32_IOCP</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32_IOCP;WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<DisableSpecificWarnings>4244;4018</DisableSpecificWarnings>
|
||||
<Optimization>Full</Optimization>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
||||
Binary file not shown.
@@ -84,6 +84,7 @@ redis_ntohs ntohs = NULL;
|
||||
redis_freeaddrinfo freeaddrinfo = NULL;
|
||||
redis_getaddrinfo getaddrinfo = NULL;
|
||||
redis_inet_ntop inet_ntop = NULL;
|
||||
redis_FD_ISSET FD_ISSET = NULL;
|
||||
}
|
||||
|
||||
auto f_WSAStartup = dllfunctor_stdcall<int, WORD, LPWSADATA>("ws2_32.dll", "WSAStartup");
|
||||
@@ -344,7 +345,8 @@ int redis_accept_impl(int sockfd, struct sockaddr *addr, socklen_t *addrlen) {
|
||||
} else {
|
||||
errno = WSAGetLastError();
|
||||
if((errno==ENOENT)||(errno==WSAEWOULDBLOCK)) {
|
||||
errno=EAGAIN;
|
||||
errno = EAGAIN;
|
||||
return RFDMap::invalidRFD;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -407,8 +409,27 @@ int redis_fcntl_impl(int fd, int cmd, int flags = 0 ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
#undef FD_ISSET
|
||||
static auto f_WSAFDIsSet = dllfunctor_stdcall<int, SOCKET, fd_set*>("ws2_32.dll", "__WSAFDIsSet");
|
||||
#define FD_ISSET(fd, set) f_WSAFDIsSet((SOCKET)(fd), (fd_set *)(set))
|
||||
int redis_FD_ISSET_impl(int fd, fd_set* pSet) {
|
||||
fd_set copy;
|
||||
FD_ZERO(©);
|
||||
for (u_int n = 0; n < pSet->fd_count; n++) {
|
||||
SOCKET s = RFDMap::getInstance().lookupSocket((RFD)(pSet->fd_array[n]));
|
||||
if (s == INVALID_SOCKET) {
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
FD_SET(s, ©);
|
||||
}
|
||||
SOCKET s = RFDMap::getInstance().lookupSocket(fd);
|
||||
if (s == INVALID_SOCKET) {
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
return f_WSAFDIsSet(s, ©);
|
||||
}
|
||||
|
||||
int redis_poll_impl(struct pollfd *fds, nfds_t nfds, int timeout) {
|
||||
try {
|
||||
struct pollfd* pollCopy = new struct pollfd[nfds];
|
||||
@@ -441,8 +462,6 @@ int redis_poll_impl(struct pollfd *fds, nfds_t nfds, int timeout) {
|
||||
|
||||
return ret;
|
||||
} else {
|
||||
static auto f_WSAFDIsSet = dllfunctor_stdcall<int, SOCKET, fd_set*>("ws2_32.dll", "__WSAFDIsSet");
|
||||
|
||||
int ret;
|
||||
fd_set readSet;
|
||||
fd_set writeSet;
|
||||
@@ -1113,6 +1132,8 @@ private:
|
||||
freeaddrinfo = redis_freeaddrinfo_impl;
|
||||
getaddrinfo = redis_getaddrinfo_impl;
|
||||
inet_ntop = redis_inet_ntop_impl;
|
||||
FD_ISSET = redis_FD_ISSET_impl;
|
||||
accept = redis_accept_impl;
|
||||
}
|
||||
|
||||
~Win32_FDSockMap() {
|
||||
|
||||
@@ -39,6 +39,7 @@ typedef int ssize_t;
|
||||
|
||||
#define INCL_WINSOCK_API_PROTOTYPES 0 // Important! Do not include Winsock API definitions to avoid conflicts with API entry points defnied below.
|
||||
#include <WinSock2.h>
|
||||
#undef FD_ISSET
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -185,6 +186,7 @@ typedef int (*redis_isatty)(int fd);
|
||||
typedef int (*redis_access)(const char *pathname, int mode);
|
||||
typedef u_int64 (*redis_lseek64)(int fd, u_int64 offset, int whence);
|
||||
typedef intptr_t (*redis_get_osfhandle)(int fd);
|
||||
typedef int(*redis_FD_ISSET)(int fd, fd_set *);
|
||||
|
||||
// access() mode definitions
|
||||
#define X_OK 0
|
||||
@@ -240,6 +242,7 @@ extern redis_get_osfhandle fdapi_get_osfhandle;
|
||||
extern redis_freeaddrinfo freeaddrinfo;
|
||||
extern redis_getaddrinfo getaddrinfo;
|
||||
extern redis_inet_ntop inet_ntop;
|
||||
extern redis_FD_ISSET FD_ISSET;
|
||||
|
||||
// other FD based APIs
|
||||
BOOL SetFDInformation(int FD, DWORD mask, DWORD flags);
|
||||
|
||||
@@ -130,7 +130,7 @@ rc.exe -foresources/EventLog.res resources/EventLog.rc</Command>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions);USE_DL_PREFIX;LACKS_STDLIB_H;USE_DLMALLOC;_CRT_SECURE_NO_WARNINGS;WIN32_IOCP;PSAPI_VERSION=1</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32_IOCP;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions);USE_DL_PREFIX;LACKS_STDLIB_H;USE_DLMALLOC;_CRT_SECURE_NO_WARNINGS;PSAPI_VERSION=1</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\..\deps\lua\src</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
@@ -169,12 +169,13 @@ rc.exe -foresources/EventLog.res resources/EventLog.rc</Command>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions);_WIN32IOCP;USE_DL_PREFIX;LACKS_STDLIB_H;USE_DLMALLOC;_CRT_SECURE_NO_WARNINGS;PSAPI_VERSION=1</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32_IOCP;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions);USE_DL_PREFIX;LACKS_STDLIB_H;USE_DLMALLOC;_CRT_SECURE_NO_WARNINGS;PSAPI_VERSION=1</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\..\deps\lua\src</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
||||
+1
-1
@@ -457,7 +457,7 @@ static int anetListen(char *err, int s, struct sockaddr *sa, socklen_t len, int
|
||||
return ANET_ERR;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef WIN32_IOCP
|
||||
if (aeWinListen(s, backlog) == SOCKET_ERROR) {
|
||||
#else
|
||||
if (listen(s, backlog) == -1) {
|
||||
|
||||
Reference in New Issue
Block a user