diff --git a/CMakeLists.txt b/CMakeLists.txt index e76df03608..774bca2cf1 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -182,6 +182,8 @@ else () set(BASE_FLAGS) set(BASE_C_FLAGS ${CMAKE_C_FLAGS}) set(BASE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) + set(BASE_LD_FLAGS $ENV{LDFLAGS}) + set(BASE_LIBS $ENV{LIBS}) endif () if (SOLARIS) @@ -226,7 +228,11 @@ if (MSVC) set(MSVC_LIBS crypt32.lib;WINMM.LIB;Ws2_32.lib;getopt;regex) set(CMAKE_EXE_LINKER_FLAGS - "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE /LTCG /SAFESEH:NO /MACHINE:x64 /ignore:4099" + "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE /LTCG /SAFESEH:NO /MACHINE:x64 /ignore:4099 ${BASE_LD_FLAGS}" + ) +else () + set(CMAKE_EXE_LINKER_FLAGS + "${CMAKE_EXE_LINKER_FLAGS} ${BASE_LD_FLAGS}" ) endif () @@ -477,6 +483,14 @@ if (VERBOSE) message(STATUS "${BASE_CXX_FLAGS}") message(STATUS) + message(STATUS "Info BASE_LD_FLAGS") + message(STATUS "${BASE_LD_FLAGS}") + message(STATUS) + + message(STATUS "Info BASE_LIBS") + message(STATUS "${BASE_LIBS}") + message(STATUS) + message(STATUS "Info CMAKE_C_FLAGS") message(STATUS "${CMAKE_C_FLAGS}") message(STATUS) @@ -700,6 +714,7 @@ list(INSERT SYSTEM_LIBRARIES 0 ${ZLIB_LIBS} ${ICU_LIBS} ${OPENSSL_LIBRARIES} + ${BASE_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS} ) diff --git a/arangod/RestServer/ArangoServer.cpp b/arangod/RestServer/ArangoServer.cpp index 305eb8cdf8..c264fb0f37 100644 --- a/arangod/RestServer/ArangoServer.cpp +++ b/arangod/RestServer/ArangoServer.cpp @@ -448,6 +448,7 @@ int ArangoServer::start() { } else if (_daemonMode) { return startupDaemon(); } else { + InitializeWorkMonitor(); _applicationServer->setupLogging(true, false, false); if (!_pidFile.empty()) { @@ -1360,7 +1361,6 @@ void ArangoServer::buildApplicationServer() { } int ArangoServer::startupServer() { - InitializeWorkMonitor(); TRI_InitializeStatistics(); OperationMode::server_operation_mode_e mode = diff --git a/lib/Basics/Logger.cpp b/lib/Basics/Logger.cpp index 02915ee61b..d927fd9496 100644 --- a/lib/Basics/Logger.cpp +++ b/lib/Basics/Logger.cpp @@ -722,7 +722,7 @@ static void QueueMessage(char const* function, char const* file, long int line, class LogThread : public Thread { public: explicit LogThread(std::string const& name) : Thread(name) {} - ~LogThread() {shutdown();} + ~LogThread() { shutdown(); } public: void run(); @@ -748,6 +748,7 @@ void LogThread::run() { delete msg; } } + //////////////////////////////////////////////////////////////////////////////// /// @brief LogTopic //////////////////////////////////////////////////////////////////////////////// @@ -1146,7 +1147,7 @@ void Logger::initialize(bool threaded) { LoggingActive.store(true); // generate threaded logging? - ThreadedLogging.store(threaded, std::memory_order_relaxed); + ThreadedLogging.store(threaded, std::memory_order_seq_cst); if (threaded) { LoggingThread = std::make_unique("Logging"); @@ -1173,9 +1174,9 @@ void Logger::shutdown(bool clearBuffers) { return; } - // logging is now inactive (this will terminate the logging thread) LoggingActive.store(false, std::memory_order_seq_cst); + // logging is now inactive (this will terminate the logging thread) // join with the logging thread if (ThreadedLogging) { // ignore all errors for now as we cannot log them anywhere... diff --git a/lib/Basics/Thread.cpp b/lib/Basics/Thread.cpp index 7199dc3247..080401d9ef 100644 --- a/lib/Basics/Thread.cpp +++ b/lib/Basics/Thread.cpp @@ -156,10 +156,12 @@ Thread::~Thread() { #endif } +#ifdef TRI_HAVE_POSIX_THREADS if (_state.load() != ThreadState::DETACHED) { LOG(FATAL) << "thread is not detached, hard shutdown"; FATAL_ERROR_EXIT(); } +#endif } ////////////////////////////////////////////////////////////////////////////////