1f2895a469
* Fix #323: Missing SelectInterrupt implementation for Windows Using WSAEventSelect, WSAWaitForMultipleEvents and WSAEnumNetworkEvents to emulate poll() with an interrupt-event. * Cleanup * Fixed incomplete comment. * Switched ifdefs to support other Unixes with pipe file descriptors * Fixed: SelectInterrupt fallback code for getFd()==-1 && getEvent()==nullptr converted a PollResultType::Timeout into a ReadyForRead causing the HttpClient to fail because it uses a hard-coded "SelectInterrupt" instance that doesn't implement getFd() and getEvent(). * Fixed gcc compile errors * - HttpClient now uses the SelectInterruptFactory - Fixed wrong ix::poll result when using Windows WSA functions * We must deselect the networkevents from the socket event. Otherwise the socket will report states that aren't there.
27 lines
524 B
C++
27 lines
524 B
C++
/*
|
|
* IXSelectInterruptFactory.cpp
|
|
* Author: Benjamin Sergeant
|
|
* Copyright (c) 2019 Machine Zone, Inc. All rights reserved.
|
|
*/
|
|
|
|
#include "IXSelectInterruptFactory.h"
|
|
|
|
#include "IXUniquePtr.h"
|
|
#if _WIN32
|
|
#include "IXSelectInterruptEvent.h"
|
|
#else
|
|
#include "IXSelectInterruptPipe.h"
|
|
#endif
|
|
|
|
namespace ix
|
|
{
|
|
SelectInterruptPtr createSelectInterrupt()
|
|
{
|
|
#ifdef _WIN32
|
|
return ix::make_unique<SelectInterruptEvent>();
|
|
#else
|
|
return ix::make_unique<SelectInterruptPipe>();
|
|
#endif
|
|
}
|
|
} // namespace ix
|