diff options
Diffstat (limited to 'src/mongo/util/net/socket_poll.cpp')
-rw-r--r-- | src/mongo/util/net/socket_poll.cpp | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/src/mongo/util/net/socket_poll.cpp b/src/mongo/util/net/socket_poll.cpp index 44ef84ff28a..f52da54355e 100644 --- a/src/mongo/util/net/socket_poll.cpp +++ b/src/mongo/util/net/socket_poll.cpp @@ -36,39 +36,37 @@ namespace mongo { #ifdef _WIN32 - typedef int (WSAAPI *WSAPollFunction)(pollfd* fdarray, ULONG nfds, INT timeout); +typedef int(WSAAPI* WSAPollFunction)(pollfd* fdarray, ULONG nfds, INT timeout); - static WSAPollFunction wsaPollFunction = NULL; +static WSAPollFunction wsaPollFunction = NULL; - MONGO_INITIALIZER(DynamicLinkWin32Poll)(InitializerContext* context) { - HINSTANCE wsaPollLib = LoadLibraryW( L"Ws2_32.dll" ); - if (wsaPollLib) { - wsaPollFunction = - reinterpret_cast<WSAPollFunction>(GetProcAddress(wsaPollLib, "WSAPoll")); - } - - return Status::OK(); +MONGO_INITIALIZER(DynamicLinkWin32Poll)(InitializerContext* context) { + HINSTANCE wsaPollLib = LoadLibraryW(L"Ws2_32.dll"); + if (wsaPollLib) { + wsaPollFunction = reinterpret_cast<WSAPollFunction>(GetProcAddress(wsaPollLib, "WSAPoll")); } - bool isPollSupported() { return wsaPollFunction != NULL; } + return Status::OK(); +} - int socketPoll( pollfd* fdarray, unsigned long nfds, int timeout ) { - fassert(17185, isPollSupported()); - return wsaPollFunction(fdarray, nfds, timeout); - } +bool isPollSupported() { + return wsaPollFunction != NULL; +} + +int socketPoll(pollfd* fdarray, unsigned long nfds, int timeout) { + fassert(17185, isPollSupported()); + return wsaPollFunction(fdarray, nfds, timeout); +} #else - bool isPollSupported() { return true; } +bool isPollSupported() { + return true; +} - int socketPoll( pollfd* fdarray, unsigned long nfds, int timeout ) { - return ::poll(fdarray, nfds, timeout); - } +int socketPoll(pollfd* fdarray, unsigned long nfds, int timeout) { + return ::poll(fdarray, nfds, timeout); +} #endif - } - - - - |