Compat. Stub IOEventWorker for systeam with no IO event interface.

This commit is contained in:
lganzzzo 2020-06-03 05:14:54 +03:00
parent b71221ac31
commit 3100d83c46
4 changed files with 20 additions and 16 deletions

View File

@ -39,7 +39,7 @@ add_library(oatpp
oatpp/core/async/worker/IOEventWorker_common.cpp
oatpp/core/async/worker/IOEventWorker_kqueue.cpp
oatpp/core/async/worker/IOEventWorker_epoll.cpp
oatpp/core/async/worker/IOEventWorker_win.cpp
oatpp/core/async/worker/IOEventWorker_stub.cpp
oatpp/core/async/worker/IOEventWorker.hpp
oatpp/core/async/worker/IOWorker.cpp
oatpp/core/async/worker/IOWorker.hpp
@ -260,16 +260,20 @@ find_package(Threads REQUIRED)
#######################################################################################################
## Link external libraries
SET(OATPP_ADD_LINK_LIBS "")
if(MSVC OR MINGW)
SET(ADD_LINK_LIBS wsock32 ws2_32)
SET(OATPP_ADD_LINK_LIBS wsock32 ws2_32)
elseif(NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
if(OATPP_LINK_ATOMIC)
SET(ADD_LINK_LIBS atomic)
SET(OATPP_ADD_LINK_LIBS atomic)
endif()
endif()
message("OATPP_ADD_LINK_LIBS=${OATPP_ADD_LINK_LIBS}")
target_link_libraries(oatpp PUBLIC ${CMAKE_THREAD_LIBS_INIT}
${ADD_LINK_LIBS}
${OATPP_ADD_LINK_LIBS}
)
target_include_directories(oatpp PUBLIC

View File

@ -164,7 +164,7 @@ v_int32 Executor::chooseTimerWorkersCount(v_int32 timerWorkersCount) {
v_int32 Executor::chooseIOWorkerType(v_int32 ioWorkerType) {
if(ioWorkerType == VALUE_SUGGESTED) {
#if defined(WIN32) || defined(_WIN32)
#if defined(OATPP_IO_EVENT_INTERFACE_STUB)
return IO_WORKER_TYPE_NAIVE;
#else
return IO_WORKER_TYPE_EVENT;

View File

@ -46,10 +46,10 @@
#define OATPP_IO_EVENT_INTERFACE "kqueue"
#define OATPP_IO_EVENT_INTERFACE_KQUEUE
#elif defined(WIN32) || defined(_WIN32)
#else
#define OATPP_IO_EVENT_INTERFACE "not-implementer(windows)"
#define OATPP_IO_EVENT_INTERFACE_WIN
#define OATPP_IO_EVENT_INTERFACE "not-implemented(windows)"
#define OATPP_IO_EVENT_INTERFACE_STUB
#endif

View File

@ -24,7 +24,7 @@
#include "IOEventWorker.hpp"
#ifdef OATPP_IO_EVENT_INTERFACE_WIN
#ifdef OATPP_IO_EVENT_INTERFACE_STUB
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// windows based implementation
@ -34,29 +34,29 @@
namespace oatpp { namespace async { namespace worker {
void IOEventWorker::initEventQueue() {
throw std::runtime_error("[IOEventWorker for Windows OS is NOT IMPLEMENTED! Use IOWorker instead.]");
throw std::runtime_error("[IOEventWorker for Target OS is NOT IMPLEMENTED! Use IOWorker instead.]");
}
void IOEventWorker::triggerWakeup() {
throw std::runtime_error("[IOEventWorker for Windows OS is NOT IMPLEMENTED! Use IOWorker instead.]");
throw std::runtime_error("[IOEventWorker for Target OS is NOT IMPLEMENTED! Use IOWorker instead.]");
}
void IOEventWorker::setTriggerEvent(p_char8 eventPtr) {
throw std::runtime_error("[IOEventWorker for Windows OS is NOT IMPLEMENTED! Use IOWorker instead.]");
throw std::runtime_error("[IOEventWorker for Target OS is NOT IMPLEMENTED! Use IOWorker instead.]");
}
void IOEventWorker::setCoroutineEvent(CoroutineHandle* coroutine, int operation, p_char8 eventPtr) {
throw std::runtime_error("[IOEventWorker for Windows OS is NOT IMPLEMENTED! Use IOWorker instead.]");
throw std::runtime_error("[IOEventWorker for Target OS is NOT IMPLEMENTED! Use IOWorker instead.]");
}
void IOEventWorker::consumeBacklog() {
throw std::runtime_error("[IOEventWorker for Windows OS is NOT IMPLEMENTED! Use IOWorker instead.]");
throw std::runtime_error("[IOEventWorker for Target OS is NOT IMPLEMENTED! Use IOWorker instead.]");
}
void IOEventWorker::waitEvents() {
throw std::runtime_error("[IOEventWorker for Windows OS is NOT IMPLEMENTED! Use IOWorker instead.]");
throw std::runtime_error("[IOEventWorker for Target OS is NOT IMPLEMENTED! Use IOWorker instead.]");
}
}}}
#endif // #ifdef OATPP_IO_EVENT_INTERFACE_KQUEUE
#endif // #ifdef OATPP_IO_EVENT_INTERFACE_STUB