From e9f9d3285cc493e309be9b0087a16df3fe6e6762 Mon Sep 17 00:00:00 2001 From: Maxim Sharabayko Date: Thu, 8 Aug 2024 13:18:43 +0200 Subject: [PATCH] [apps] Fixed verbose linkage difference. --- CMakeLists.txt | 2 -- apps/verbose.cpp | 11 ++--------- apps/verbose.hpp | 13 +------------ 3 files changed, 3 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6500e364b..9a2fc63d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1383,7 +1383,6 @@ if (ENABLE_APPS) # srt-multiplex temporarily blocked #srt_add_application(srt-multiplex ${VIRTUAL_srtsupport}) srt_add_application(srt-tunnel ${VIRTUAL_srtsupport}) - target_compile_definitions(srt-tunnel PUBLIC -DSRT_ENABLE_VERBOSE_LOCK) endif() if (ENABLE_TESTING) @@ -1421,7 +1420,6 @@ if (ENABLE_APPS) srt_add_testprogram(srt-test-relay) srt_make_application(srt-test-relay) - target_compile_definitions(srt-test-relay PUBLIC -DSRT_ENABLE_VERBOSE_LOCK) srt_add_testprogram(srt-test-multiplex) srt_make_application(srt-test-multiplex) diff --git a/apps/verbose.cpp b/apps/verbose.cpp index 58cf83fbe..61c507ad7 100644 --- a/apps/verbose.cpp +++ b/apps/verbose.cpp @@ -9,14 +9,13 @@ */ #include "verbose.hpp" +#include namespace Verbose { bool on = false; std::ostream* cverb = &std::cerr; -#if SRT_ENABLE_VERBOSE_LOCK std::mutex vlock; -#endif Log& Log::operator<<(LogNoEol) { @@ -28,19 +27,16 @@ namespace Verbose return *this; } -#if SRT_ENABLE_VERBOSE_LOCK Log& Log::operator<<(LogLock) { lockline = true; return *this; } -#endif Log::~Log() { if (on && !noeol) { -#if SRT_ENABLE_VERBOSE_LOCK if (lockline) { // Lock explicitly, as requested, and wait for the opportunity. @@ -48,7 +44,7 @@ namespace Verbose } else if (vlock.try_lock()) { - // Successfully locked, so unlock immediately, locking wasn't requeted. + // Successfully locked, so unlock immediately, locking wasn't required. vlock.unlock(); } else @@ -62,15 +58,12 @@ namespace Verbose vlock.lock(); vlock.unlock(); } -#endif (*cverb) << std::endl; -#if SRT_ENABLE_VERBOSE_LOCK // If lockline is set, the lock was requested and WAS DONE, so unlock. // Otherwise locking WAS NOT DONE. if (lockline) vlock.unlock(); -#endif } } } diff --git a/apps/verbose.hpp b/apps/verbose.hpp index 879d54086..80f3b306b 100644 --- a/apps/verbose.hpp +++ b/apps/verbose.hpp @@ -12,9 +12,6 @@ #define INC_SRT_VERBOSE_HPP #include -#if SRT_ENABLE_VERBOSE_LOCK -#include -#endif namespace Verbose { @@ -23,19 +20,15 @@ extern bool on; extern std::ostream* cverb; struct LogNoEol { LogNoEol() {} }; -#if SRT_ENABLE_VERBOSE_LOCK struct LogLock { LogLock() {} }; -#endif class Log { bool noeol = false; -#if SRT_ENABLE_VERBOSE_LOCK bool lockline = false; -#endif // Disallow creating dynamic objects - void* operator new(size_t); + void* operator new(size_t) = delete; public: @@ -50,9 +43,7 @@ class Log } Log& operator<<(LogNoEol); -#if SRT_ENABLE_VERBOSE_LOCK Log& operator<<(LogLock); -#endif ~Log(); }; @@ -99,8 +90,6 @@ inline void Verb(Args&&... args) // Manipulator tags static const Verbose::LogNoEol VerbNoEOL; -#if SRT_ENABLE_VERBOSE_LOCK static const Verbose::LogLock VerbLock; -#endif #endif