diff --git a/src/domino/DataDomino.hpp b/src/domino/DataDomino.hpp index f1b1740..956fa76 100644 --- a/src/domino/DataDomino.hpp +++ b/src/domino/DataDomino.hpp @@ -15,7 +15,7 @@ #include "DataStore.hpp" #include "UniLog.hpp" -namespace RLib +namespace rlib { // *********************************************************************************************** template diff --git a/src/domino/Domino.cpp b/src/domino/Domino.cpp index 98e86cc..cae5f55 100644 --- a/src/domino/Domino.cpp +++ b/src/domino/Domino.cpp @@ -9,7 +9,7 @@ using namespace std; -namespace RLib +namespace rlib { static const Domino::Events defaultEVs; // internal use only @@ -144,7 +144,7 @@ void Domino::pureSetPrev_(const Event& aValidEv, const SimuEvents& aSimuPrevEven // *********************************************************************************************** bool Domino::pureSetStateOK_(const Event& aValidEv, const bool aNewState) { - if (states_[aValidEv] != aNewState) // do need change + if (states_[aValidEv] != aNewState) // do need change { states_[aValidEv] = aNewState; HID("(Domino) Succeed, EvName=" << ev_en_[aValidEv] << " newState=" << aNewState); diff --git a/src/domino/Domino.hpp b/src/domino/Domino.hpp index d3f959f..815138e 100644 --- a/src/domino/Domino.hpp +++ b/src/domino/Domino.hpp @@ -54,7 +54,7 @@ #include "UniLog.hpp" -namespace RLib +namespace rlib { const char DOM_RESERVED_EVNAME[] = "[Dom Reserved EvName]"; diff --git a/src/domino/FreeHdlrDomino.hpp b/src/domino/FreeHdlrDomino.hpp index 438727d..e230efc 100644 --- a/src/domino/FreeHdlrDomino.hpp +++ b/src/domino/FreeHdlrDomino.hpp @@ -22,7 +22,7 @@ #include -namespace RLib +namespace rlib { // *********************************************************************************************** template diff --git a/src/domino/HdlrDomino.hpp b/src/domino/HdlrDomino.hpp index 5f23641..a25b618 100644 --- a/src/domino/HdlrDomino.hpp +++ b/src/domino/HdlrDomino.hpp @@ -27,6 +27,7 @@ #pragma once #include +#include #include #include "MsgSelf.hpp" @@ -34,7 +35,7 @@ #include "SafePtr.hpp" #include "UniLog.hpp" -namespace RLib +namespace rlib { // *********************************************************************************************** template diff --git a/src/domino/MultiHdlrDomino.hpp b/src/domino/MultiHdlrDomino.hpp index 434439c..a950a59 100644 --- a/src/domino/MultiHdlrDomino.hpp +++ b/src/domino/MultiHdlrDomino.hpp @@ -20,12 +20,13 @@ #pragma once #include +#include #include #include #include "UniLog.hpp" -namespace RLib +namespace rlib { // *********************************************************************************************** template @@ -175,7 +176,7 @@ bool MultiHdlrDomino::rmOneHdlrOK_(const Domino::Event& aValidEv, c // rm auto&& ev_hdlrs = ev_hdlrs_S_.find(aValidEv); - //if (ev_hdlrs == ev_hdlrs_S_.end()) return false; // impossible if valid aValidHdlr + // if (ev_hdlrs == ev_hdlrs_S_.end()) return false; // impossible if valid aValidHdlr for (auto&& name_hdlr = ev_hdlrs->second.begin(); name_hdlr != ev_hdlrs->second.end(); ++name_hdlr) { if (name_hdlr->second != aValidHdlr) diff --git a/src/domino/PriDomino.hpp b/src/domino/PriDomino.hpp index 9fb4d4a..64aee2e 100644 --- a/src/domino/PriDomino.hpp +++ b/src/domino/PriDomino.hpp @@ -17,7 +17,7 @@ #include #include "UniLog.hpp" -namespace RLib +namespace rlib { // *********************************************************************************************** template diff --git a/src/domino/RmEvDom.hpp b/src/domino/RmEvDom.hpp index 33e6843..843edb2 100644 --- a/src/domino/RmEvDom.hpp +++ b/src/domino/RmEvDom.hpp @@ -31,7 +31,7 @@ #include -namespace RLib +namespace rlib { // *********************************************************************************************** template diff --git a/src/domino/WbasicDatDom.hpp b/src/domino/WbasicDatDom.hpp index b83e231..5f8d787 100644 --- a/src/domino/WbasicDatDom.hpp +++ b/src/domino/WbasicDatDom.hpp @@ -11,9 +11,10 @@ // *********************************************************************************************** #pragma once +#include #include "UniLog.hpp" -namespace RLib +namespace rlib { // *********************************************************************************************** template diff --git a/src/log/BaseSL.hpp b/src/log/BaseSL.hpp index 9578f7d..6e14971 100644 --- a/src/log/BaseSL.hpp +++ b/src/log/BaseSL.hpp @@ -16,7 +16,7 @@ // *********************************************************************************************** #pragma once -namespace RLib +namespace rlib { // *********************************************************************************************** class BaseSL // SL = Smart Log @@ -27,7 +27,7 @@ class BaseSL // SL = Smart Log //------------------------------------------------------------------------------------------------ protected: // derive use only - virtual ~BaseSL() = default; + virtual ~BaseSL() = default; //------------------------------------------------------------------------------------------------ private: diff --git a/src/log/StrCoutFSL.hpp b/src/log/StrCoutFSL.hpp index 87bdd79..87027f1 100644 --- a/src/log/StrCoutFSL.hpp +++ b/src/log/StrCoutFSL.hpp @@ -21,11 +21,11 @@ #pragma once #include -#include //stringstream +#include // stringstream #include "BaseSL.hpp" -namespace RLib +namespace rlib { // *********************************************************************************************** class StrCoutFSL // FSL = Formatted Smart Log @@ -44,7 +44,7 @@ public : inline StrCoutFSL::~StrCoutFSL() { - if( canDelLog() ) + if (canDelLog()) return; forceSave(); diff --git a/src/log/UniBaseLog.hpp b/src/log/UniBaseLog.hpp index 512bb37..2f3f955 100644 --- a/src/log/UniBaseLog.hpp +++ b/src/log/UniBaseLog.hpp @@ -37,7 +37,7 @@ using LogName = std::string; #define GTEST_LOG_FAIL { if (Test::HasFailure()) needLog(); } // UT only -namespace RLib +namespace rlib { // *********************************************************************************************** // - MT safe : yes @@ -48,7 +48,8 @@ inline const char* timestamp() auto now_tp = std::chrono::system_clock::now(); auto now_tt = std::chrono::system_clock::to_time_t(now_tp); - strftime(buf, sizeof(buf), "%j/%T.", localtime(&now_tt)); + struct tm now_tm; + strftime(buf, sizeof(buf), "%j/%T.", localtime_r(&now_tt, &now_tm)); // cpplint asks localtime_r (MT safe) snprintf(buf + sizeof(buf) - 7, 7, "%06u", // snprintf is safer than sprintf unsigned(std::chrono::duration_cast(now_tp.time_since_epoch()).count() % 1'000'000)); diff --git a/src/log/UniCoutLog.cpp b/src/log/UniCoutLog.cpp index 5cf065d..6865078 100644 --- a/src/log/UniCoutLog.cpp +++ b/src/log/UniCoutLog.cpp @@ -8,7 +8,7 @@ using namespace std; -namespace RLib +namespace rlib { // *********************************************************************************************** ostream& UniCoutLog::oneLog() diff --git a/src/log/UniCoutLog.hpp b/src/log/UniCoutLog.hpp index 93f4da2..6615da8 100644 --- a/src/log/UniCoutLog.hpp +++ b/src/log/UniCoutLog.hpp @@ -24,7 +24,7 @@ #include "UniBaseLog.hpp" -namespace RLib +namespace rlib { // *********************************************************************************************** class UniCoutLog diff --git a/src/log/UniLog.hpp b/src/log/UniLog.hpp index 0d1eb04..71b937d 100644 --- a/src/log/UniLog.hpp +++ b/src/log/UniLog.hpp @@ -43,7 +43,7 @@ // : : : : // : : : : // UniSmartLogTest.cpp UniCoutLogTest.cpp - // +// // - REQ: // * uni-interface (INF/...) for all users (eg DomLib, swm, rfsw) // * easily support INF/etc macros diff --git a/src/log/UniSmartLog.cpp b/src/log/UniSmartLog.cpp index cb41191..59b3d8d 100644 --- a/src/log/UniSmartLog.cpp +++ b/src/log/UniSmartLog.cpp @@ -8,12 +8,12 @@ using namespace std; -namespace RLib +namespace rlib { // *********************************************************************************************** UniSmartLog::UniSmartLog(const LogName& aUniLogName) : uniLogName_(aUniLogName) { - //for(auto&& name_log : name_log_S_) cout << name_log.first<<", p=" << name_log.second.get() << endl; + // for(auto&& name_log : name_log_S_) cout << name_log.first<<", p=" << name_log.second.get() << endl; auto&& name_log = name_log_S_.find(aUniLogName); if (name_log == name_log_S_.end()) { diff --git a/src/log/UniSmartLog.hpp b/src/log/UniSmartLog.hpp index 9311889..145aad4 100644 --- a/src/log/UniSmartLog.hpp +++ b/src/log/UniSmartLog.hpp @@ -27,7 +27,7 @@ #include "StrCoutFSL.hpp" #include "UniBaseLog.hpp" -namespace RLib +namespace rlib { // *********************************************************************************************** using SmartLog = StrCoutFSL; diff --git a/src/msg_self/MsgSelf.cpp b/src/msg_self/MsgSelf.cpp index cee787a..0ef390b 100644 --- a/src/msg_self/MsgSelf.cpp +++ b/src/msg_self/MsgSelf.cpp @@ -7,7 +7,7 @@ #include "MsgSelf.hpp" #include "MT_PingMainTH.hpp" -namespace RLib +namespace rlib { // *********************************************************************************************** // - performance optimization need 5 lines code, with a little benfit in most cases diff --git a/src/msg_self/MsgSelf.hpp b/src/msg_self/MsgSelf.hpp index b8e022a..5ce405c 100644 --- a/src/msg_self/MsgSelf.hpp +++ b/src/msg_self/MsgSelf.hpp @@ -38,14 +38,15 @@ // *********************************************************************************************** #pragma once -#include #include +#include +#include #include "UniLog.hpp" #define MSG_SELF (ObjAnywhere::getObj()) -namespace RLib +namespace rlib { // *********************************************************************************************** enum EMsgPriority : unsigned char diff --git a/src/obj_anywhere/DataStore.hpp b/src/obj_anywhere/DataStore.hpp index 569e48a..5b1c6a7 100644 --- a/src/obj_anywhere/DataStore.hpp +++ b/src/obj_anywhere/DataStore.hpp @@ -20,7 +20,7 @@ #include "SafePtr.hpp" // can't UniPtr.hpp since ut(=req) build-err #include "UniLog.hpp" // debug -namespace RLib +namespace rlib { // *********************************************************************************************** template diff --git a/src/obj_anywhere/ObjAnywhere.cpp b/src/obj_anywhere/ObjAnywhere.cpp index baeba33..6f057ca 100644 --- a/src/obj_anywhere/ObjAnywhere.cpp +++ b/src/obj_anywhere/ObjAnywhere.cpp @@ -3,11 +3,12 @@ * Licensed under the BSD 3 Clause license * SPDX-License-Identifier: BSD-3-Clause */ +#include #include "ObjAnywhere.hpp" using namespace std; -namespace RLib +namespace rlib { shared_ptr> ObjAnywhere::name_obj_S_; diff --git a/src/obj_anywhere/ObjAnywhere.hpp b/src/obj_anywhere/ObjAnywhere.hpp index 092748a..f1f5186 100644 --- a/src/obj_anywhere/ObjAnywhere.hpp +++ b/src/obj_anywhere/ObjAnywhere.hpp @@ -22,12 +22,13 @@ // *********************************************************************************************** #pragma once +#include #include #include "DataStore.hpp" #include "UniLog.hpp" -namespace RLib +namespace rlib { using ObjName = std::string; diff --git a/src/safe_mem/SafePtr.hpp b/src/safe_mem/SafePtr.hpp index 330d604..b4f194a 100644 --- a/src/safe_mem/SafePtr.hpp +++ b/src/safe_mem/SafePtr.hpp @@ -33,10 +33,11 @@ #include #include #include +#include #include "UniLog.hpp" -namespace RLib +namespace rlib { // *********************************************************************************************** template @@ -103,17 +104,17 @@ std::shared_ptr SafePtr::cast() const noexcept { if constexpr(std::is_base_of_v) // safer than is_convertible() { - //HID("(SafePtr) cast to base/self"); // ERR() not MT safe + // HID("(SafePtr) cast to base/self"); // ERR() not MT safe return std::dynamic_pointer_cast(pT_); // private/protected inherit will compile err(rare & no easy fix) } - else if constexpr(std::is_base_of_v) // else if for constexpr + else if constexpr(std::is_base_of_v) // else if for constexpr { - //HID("(SafePtr) cast to derived"); + // HID("(SafePtr) cast to derived"); return std::dynamic_pointer_cast(pT_); } else if constexpr(std::is_void_v) { - //HID("(SafePtr) cast to void (for container to store diff types)"); + // HID("(SafePtr) cast to void (for container to store diff types)"); return pT_; } else if constexpr(!std::is_void_v) @@ -124,12 +125,12 @@ std::shared_ptr SafePtr::cast() const noexcept else if (realType_ == typeid(To)) { - //HID("(SafePtr) cast void->origin"); + // HID("(SafePtr) cast void->origin"); return std::static_pointer_cast(pT_); } else if (lastType_ == typeid(To)) { - //HID("(SafePtr) cast void to last-type-except-void"); + // HID("(SafePtr) cast void to last-type-except-void"); return std::static_pointer_cast(pT_); } HID("(SafePtr) can't cast from=void/" << typeid(T).name() << " to=" << typeid(To).name()); @@ -155,9 +156,9 @@ void SafePtr::init_(const SafePtr& aSafeFrom) noexcept else lastType_ = aSafeFrom.lastType(); - /*HID("cp from=" << typeid(From).name() << " to=" << typeid(T).name() + /* HID("cp from=" << typeid(From).name() << " to=" << typeid(T).name() << ", diff=" << (lastType_ == nullptr ? "null" : lastType_->name()) - << ", real=" << (realType_ == nullptr ? "null" : realType_->name()));*/ + << ", real=" << (realType_ == nullptr ? "null" : realType_->name())); */ } @@ -168,7 +169,7 @@ SafePtr make_safe(ConstructArgs&&... aArgs) { SafePtr safeU; safeU.pT_ = std::make_shared(std::forward(aArgs)...); // std::~, or ambiguous with boost::~ - //HID("new ptr=" << (void*)(safeU.pT_.get())); // too many print; void* print addr rather than content(dangeous) + // HID("new ptr=" << (void*)(safeU.pT_.get())); // too many print; void* print addr rather than content(dangeous) return safeU; } @@ -194,9 +195,9 @@ bool operator<(SafePtr lhs, SafePtr rhs) // *********************************************************************************************** template -RLib::SafePtr std::dynamic_pointer_cast(const RLib::SafePtr& aSafeFrom) noexcept +rlib::SafePtr std::dynamic_pointer_cast(const rlib::SafePtr& aSafeFrom) noexcept { - RLib::SafePtr safeTo; + rlib::SafePtr safeTo; safeTo.pT_ = aSafeFrom.template cast(); safeTo.init_(aSafeFrom); return safeTo; @@ -204,16 +205,16 @@ RLib::SafePtr std::dynamic_pointer_cast(const RLib::SafePtr& aSafeFrom // *********************************************************************************************** template -RLib::SafePtr std::static_pointer_cast(const RLib::SafePtr& aSafeFrom) noexcept +rlib::SafePtr std::static_pointer_cast(const rlib::SafePtr& aSafeFrom) noexcept { return std::dynamic_pointer_cast(aSafeFrom); } // *********************************************************************************************** template -struct std::hash> +struct std::hash> { - auto operator()(const RLib::SafePtr& aSafePtr) const { return hash>()(aSafePtr.get()); } + auto operator()(const rlib::SafePtr& aSafePtr) const { return hash>()(aSafePtr.get()); } }; // *********************************************************************************************** diff --git a/src/safe_mem/UniPtr.hpp b/src/safe_mem/UniPtr.hpp index 80966db..4bbef72 100644 --- a/src/safe_mem/UniPtr.hpp +++ b/src/safe_mem/UniPtr.hpp @@ -16,7 +16,7 @@ #include // make_shared #if 0 -namespace RLib +namespace rlib { // std::~, or ambiguous with boost::~ using UniPtr = std::shared_ptr; @@ -25,7 +25,7 @@ using UniPtr = std::shared_ptr; #else #include "SafePtr.hpp" -namespace RLib +namespace rlib { using UniPtr = SafePtr; #define MAKE_PTR make_safe diff --git a/src/thread/AsyncBack.cpp b/src/thread/AsyncBack.cpp index f24d92b..5bdada5 100644 --- a/src/thread/AsyncBack.cpp +++ b/src/thread/AsyncBack.cpp @@ -7,7 +7,7 @@ using namespace std; -namespace RLib +namespace rlib { // *********************************************************************************************** bool AsyncBack::newTaskOK(const MT_TaskEntryFN& mt_aEntryFN, const TaskBackFN& aBackFN, UniLog& oneLog) @@ -29,7 +29,7 @@ bool AsyncBack::newTaskOK(const MT_TaskEntryFN& mt_aEntryFN, const TaskBackFN& a ), aBackFN ); - //HID("(AsyncBack) valid=" << fut_backFN_S_.back().first.valid() << ", backFn=" << &(fut_backFN_S_.back().second)); + // HID("(AsyncBack) valid=" << fut_backFN_S_.back().first.valid() << ", backFn=" << &(fut_backFN_S_.back().second)); return true; } diff --git a/src/thread/AsyncBack.hpp b/src/thread/AsyncBack.hpp index fe1bac9..a8bd52d 100644 --- a/src/thread/AsyncBack.hpp +++ b/src/thread/AsyncBack.hpp @@ -38,13 +38,13 @@ // - class safe: yes // * all AsyncBack func (include ThreadBack) must run in 1 thread (best in main thread) // . AsyncBack can call inMyMainTH() to ensure this -// . but can all RLib func call inMyMainTH()? little benefit so giveup -// * common sense/principle: RLib (include AsyncBack) not call inMyMainTH() +// . but can all rlib func call inMyMainTH()? little benefit so giveup +// * common sense/principle: rlib (include AsyncBack) not call inMyMainTH() // . inMyMainTH() for user debug - any main-thread func shall ret T if call inMyMainTH() -// * same for exception - assume no exception from any hdlr provided to RLib +// * same for exception - assume no exception from any hdlr provided to rlib // . no duty to any unsafe behavior of MT_TaskEntryFN & TaskBackFN (eg throw exception) // . MT_TaskEntryFN & TaskBackFN shall NOT throw exception -// . they can try-catch all exception & leave RLib simple/focus +// . they can try-catch all exception & leave rlib simple/focus // // - support multi-thread // . MT_/mt_ prefix: yes @@ -54,7 +54,7 @@ #include "ThreadBack.hpp" -namespace RLib +namespace rlib { // *********************************************************************************************** class AsyncBack : public ThreadBack diff --git a/src/thread/MT_PingMainTH.cpp b/src/thread/MT_PingMainTH.cpp index f022440..cb39bfb 100644 --- a/src/thread/MT_PingMainTH.cpp +++ b/src/thread/MT_PingMainTH.cpp @@ -5,7 +5,7 @@ */ #include "MT_PingMainTH.hpp" -namespace RLib +namespace rlib { MT_Semaphore g_semToMainTH; } // namespace diff --git a/src/thread/MT_PingMainTH.hpp b/src/thread/MT_PingMainTH.hpp index 3fb8d86..44a96a8 100644 --- a/src/thread/MT_PingMainTH.hpp +++ b/src/thread/MT_PingMainTH.hpp @@ -16,7 +16,7 @@ #include "MT_Semaphore.hpp" -namespace RLib +namespace rlib { // *********************************************************************************************** // - can't use ObjAnywhere that is not MT safe diff --git a/src/thread/MT_Semaphore.cpp b/src/thread/MT_Semaphore.cpp index effdbe8..aa6a033 100644 --- a/src/thread/MT_Semaphore.cpp +++ b/src/thread/MT_Semaphore.cpp @@ -3,14 +3,14 @@ * Licensed under the BSD 3 Clause license * SPDX-License-Identifier: BSD-3-Clause */ +#include // C header #include -#include #include "MT_Semaphore.hpp" using namespace std; -namespace RLib +namespace rlib { // *********************************************************************************************** void MT_Semaphore::mt_notify() noexcept diff --git a/src/thread/MT_Semaphore.hpp b/src/thread/MT_Semaphore.hpp index a9dba42..9a716fc 100644 --- a/src/thread/MT_Semaphore.hpp +++ b/src/thread/MT_Semaphore.hpp @@ -23,7 +23,7 @@ #include #include -namespace RLib +namespace rlib { // *********************************************************************************************** class MT_Semaphore diff --git a/src/thread/MtInQueue.cpp b/src/thread/MtInQueue.cpp index 0dd1ca8..617fcb3 100644 --- a/src/thread/MtInQueue.cpp +++ b/src/thread/MtInQueue.cpp @@ -5,13 +5,14 @@ */ // *********************************************************************************************** #include +#include #include "MT_PingMainTH.hpp" #include "MtInQueue.hpp" using namespace std; -namespace RLib +namespace rlib { // *********************************************************************************************** MtInQueue::~MtInQueue() @@ -39,7 +40,7 @@ deque::iterator MtInQueue::begin_() } // unlocked - //HID("(MtQ) ptr=" << cache_.begin()->first.get() << ", nRef=" << cache_.begin()->first.use_count()); + // HID("(MtQ) ptr=" << cache_.begin()->first.get() << ", nRef=" << cache_.begin()->first.use_count()); return cache_.begin(); } diff --git a/src/thread/MtInQueue.hpp b/src/thread/MtInQueue.hpp index cc9624c..236153f 100644 --- a/src/thread/MtInQueue.hpp +++ b/src/thread/MtInQueue.hpp @@ -28,12 +28,13 @@ #include #include #include +#include #include "MT_PingMainTH.hpp" #include "UniLog.hpp" #include "UniPtr.hpp" -namespace RLib +namespace rlib { // - ele & its type_index(==/!= ok, but type_info* & hash_code nok) // - shared_ptr is safe to cast void since type_index (but not safe as SafePtr's create) @@ -102,7 +103,7 @@ void MtInQueue::mt_push(PTR&& aEle) { std::lock_guard guard(mutex_); queue_.push_back(ELE_TID(std::move(aEle), typeid(aEleType))); - //HID("(MtQ) ptr=" << aEle.get() << ", nRef=" << aEle.use_count()); // HID supports MT + // HID("(MtQ) ptr=" << aEle.get() << ", nRef=" << aEle.use_count()); // HID supports MT } // unlock then notify main thread diff --git a/src/thread/ThPoolBack.cpp b/src/thread/ThPoolBack.cpp index d6de624..a53fc30 100644 --- a/src/thread/ThPoolBack.cpp +++ b/src/thread/ThPoolBack.cpp @@ -3,11 +3,12 @@ * Licensed under the BSD 3 Clause license * SPDX-License-Identifier: BSD-3-Clause */ +#include #include "ThPoolBack.hpp" using namespace std; -namespace RLib +namespace rlib { // *********************************************************************************************** ThPoolBack::ThPoolBack(size_t aMaxThread) diff --git a/src/thread/ThPoolBack.hpp b/src/thread/ThPoolBack.hpp index a4ae9b3..ceff5ac 100644 --- a/src/thread/ThPoolBack.hpp +++ b/src/thread/ThPoolBack.hpp @@ -20,7 +20,7 @@ #include "ThreadBack.hpp" -namespace RLib +namespace rlib { // *********************************************************************************************** class ThPoolBack : public ThreadBack diff --git a/src/thread/ThreadBack.cpp b/src/thread/ThreadBack.cpp index bebfc6b..843df66 100644 --- a/src/thread/ThreadBack.cpp +++ b/src/thread/ThreadBack.cpp @@ -12,7 +12,7 @@ using namespace std; -namespace RLib +namespace rlib { // *********************************************************************************************** size_t ThreadBack::hdlFinishedTasks(UniLog& oneLog) @@ -24,7 +24,7 @@ size_t ThreadBack::hdlFinishedTasks(UniLog& oneLog) // - valid async()'s future never invalid // - valid packaged_task's get_future() never invalid auto&& fut = fut_backFN->first; - //HID("(ThreadBack) nHandled=" << nHandled << ", valid=" << fut.valid() << ", backFn=" << &(fut_backFN->second)); + // HID("(ThreadBack) nHandled=" << nHandled << ", valid=" << fut.valid() << ", backFn=" << &(fut_backFN->second)); if (fut.wait_for(0s) == future_status::ready) { fut_backFN->second(fut.get()); // callback diff --git a/src/thread/ThreadBack.hpp b/src/thread/ThreadBack.hpp index 3280dd0..c09736b 100644 --- a/src/thread/ThreadBack.hpp +++ b/src/thread/ThreadBack.hpp @@ -13,13 +13,14 @@ #include #include #include +#include #include "MT_PingMainTH.hpp" #include "UniLog.hpp" -#define THREAD_BACK (RLib::ObjAnywhere::getObj()) +#define THREAD_BACK (rlib::ObjAnywhere::getObj()) -namespace RLib +namespace rlib { // *********************************************************************************************** using MT_TaskEntryFN = std::function; // succ ret true, otherwise false diff --git a/src/thread/ThreadBackViaMsgSelf.hpp b/src/thread/ThreadBackViaMsgSelf.hpp index a568ccf..1b76a95 100644 --- a/src/thread/ThreadBackViaMsgSelf.hpp +++ b/src/thread/ThreadBackViaMsgSelf.hpp @@ -12,10 +12,12 @@ // // - mem safe: yes // *********************************************************************************************** +#include + #include "MsgSelf.hpp" #include "ThreadBack.hpp" -namespace RLib +namespace rlib { // *********************************************************************************************** // wrap TaskBackFN to queue in MsgSelf diff --git a/ut/domino/DataDominoTest.cpp b/ut/domino/DataDominoTest.cpp index 97c5dc5..d88227c 100644 --- a/ut/domino/DataDominoTest.cpp +++ b/ut/domino/DataDominoTest.cpp @@ -9,7 +9,7 @@ #include "UtInitObjAnywhere.hpp" -namespace RLib +namespace rlib { // *********************************************************************************************** template diff --git a/ut/domino/DominoTest.cpp b/ut/domino/DominoTest.cpp index 1e588fd..755107f 100644 --- a/ut/domino/DominoTest.cpp +++ b/ut/domino/DominoTest.cpp @@ -9,7 +9,7 @@ #include "UtInitObjAnywhere.hpp" -namespace RLib +namespace rlib { // *********************************************************************************************** template diff --git a/ut/domino/FreeHdlrDominoTest.cpp b/ut/domino/FreeHdlrDominoTest.cpp index 428ec38..7c5478c 100644 --- a/ut/domino/FreeHdlrDominoTest.cpp +++ b/ut/domino/FreeHdlrDominoTest.cpp @@ -10,7 +10,7 @@ #include "UtInitObjAnywhere.hpp" -namespace RLib +namespace rlib { // *********************************************************************************************** template diff --git a/ut/domino/HdlrDominoTest.cpp b/ut/domino/HdlrDominoTest.cpp index 21cb849..ccc5aa7 100644 --- a/ut/domino/HdlrDominoTest.cpp +++ b/ut/domino/HdlrDominoTest.cpp @@ -9,7 +9,7 @@ #include "UtInitObjAnywhere.hpp" -namespace RLib +namespace rlib { // *********************************************************************************************** template diff --git a/ut/domino/MultiHdlrDominoTest.cpp b/ut/domino/MultiHdlrDominoTest.cpp index 3a0066e..167b0a3 100644 --- a/ut/domino/MultiHdlrDominoTest.cpp +++ b/ut/domino/MultiHdlrDominoTest.cpp @@ -10,7 +10,7 @@ #include "UtInitObjAnywhere.hpp" -namespace RLib +namespace rlib { // *********************************************************************************************** template diff --git a/ut/domino/PriDominoTest.cpp b/ut/domino/PriDominoTest.cpp index a9064d8..e8f3974 100644 --- a/ut/domino/PriDominoTest.cpp +++ b/ut/domino/PriDominoTest.cpp @@ -10,7 +10,7 @@ #include "UtInitObjAnywhere.hpp" -namespace RLib +namespace rlib { // *********************************************************************************************** template diff --git a/ut/domino/RmEvDomTest.cpp b/ut/domino/RmEvDomTest.cpp index 8584c2d..91b1a09 100644 --- a/ut/domino/RmEvDomTest.cpp +++ b/ut/domino/RmEvDomTest.cpp @@ -9,7 +9,7 @@ #include "UtInitObjAnywhere.hpp" -namespace RLib +namespace rlib { // *********************************************************************************************** template diff --git a/ut/domino/WbasicDatDomTest.cpp b/ut/domino/WbasicDatDomTest.cpp index 9dc56bc..ab9f03f 100644 --- a/ut/domino/WbasicDatDomTest.cpp +++ b/ut/domino/WbasicDatDomTest.cpp @@ -10,7 +10,7 @@ #include "UtInitObjAnywhere.hpp" -namespace RLib +namespace rlib { // *********************************************************************************************** template diff --git a/ut/log/UniLogTest.hpp b/ut/log/UniLogTest.hpp index 41ce640..a901e85 100644 --- a/ut/log/UniLogTest.hpp +++ b/ut/log/UniLogTest.hpp @@ -9,7 +9,7 @@ using namespace std; using namespace testing; -namespace RLib +namespace rlib { // *********************************************************************************************** struct UNI_LOG_TEST : public Test diff --git a/ut/msg_self/MsgSelfTest.cpp b/ut/msg_self/MsgSelfTest.cpp index b098721..5f7e97d 100644 --- a/ut/msg_self/MsgSelfTest.cpp +++ b/ut/msg_self/MsgSelfTest.cpp @@ -17,7 +17,7 @@ using namespace std; using namespace std::chrono; using namespace testing; -namespace RLib +namespace rlib { // *********************************************************************************************** struct MsgSelfTest : public Test, public UniLog diff --git a/ut/obj_anywhere/DataStoreTest.cpp b/ut/obj_anywhere/DataStoreTest.cpp index 00ab29c..d484376 100644 --- a/ut/obj_anywhere/DataStoreTest.cpp +++ b/ut/obj_anywhere/DataStoreTest.cpp @@ -14,7 +14,7 @@ using namespace std; using namespace testing; -namespace RLib +namespace rlib { // *********************************************************************************************** struct DataStoreTest : public Test diff --git a/ut/obj_anywhere/ObjAnywhereTest.cpp b/ut/obj_anywhere/ObjAnywhereTest.cpp index e7b1edf..36fa7be 100644 --- a/ut/obj_anywhere/ObjAnywhereTest.cpp +++ b/ut/obj_anywhere/ObjAnywhereTest.cpp @@ -11,7 +11,7 @@ using namespace testing; -namespace RLib +namespace rlib { // *********************************************************************************************** struct ObjAnywhereTest : public Test, public UniLog diff --git a/ut/obj_anywhere/UtInitObjAnywhere.hpp b/ut/obj_anywhere/UtInitObjAnywhere.hpp index f38da8f..55c16a8 100644 --- a/ut/obj_anywhere/UtInitObjAnywhere.hpp +++ b/ut/obj_anywhere/UtInitObjAnywhere.hpp @@ -33,7 +33,7 @@ using namespace std; using namespace testing; -namespace RLib +namespace rlib { using MinHdlrDom = HdlrDomino; using MinMhdlrDom = MultiHdlrDomino; diff --git a/ut/safe_mem/SafePtrTest.cpp b/ut/safe_mem/SafePtrTest.cpp index 811518a..e424e7e 100644 --- a/ut/safe_mem/SafePtrTest.cpp +++ b/ut/safe_mem/SafePtrTest.cpp @@ -14,7 +14,7 @@ using namespace std; -namespace RLib +namespace rlib { #define CREATE // *********************************************************************************************** diff --git a/ut/thread/MtInQueueTest.cpp b/ut/thread/MtInQueueTest.cpp index 87b0f24..715dbad 100644 --- a/ut/thread/MtInQueueTest.cpp +++ b/ut/thread/MtInQueueTest.cpp @@ -21,7 +21,7 @@ using namespace std; using namespace testing; -namespace RLib +namespace rlib { // *********************************************************************************************** struct MtInQueueTest : public Test, public UniLog diff --git a/ut/thread/ThPoolBackTest.cpp b/ut/thread/ThPoolBackTest.cpp index c5c23a4..87fbbf1 100644 --- a/ut/thread/ThPoolBackTest.cpp +++ b/ut/thread/ThPoolBackTest.cpp @@ -4,7 +4,7 @@ #undef THREAD_BACK_TYPE #undef THREAD_BACK_TEST -namespace RLib +namespace rlib { // *********************************************************************************************** TEST_F(ThPoolBackTest, invalid_maxThread) diff --git a/ut/thread/ThreadBackTest.hpp b/ut/thread/ThreadBackTest.hpp index 48a7394..c40beb4 100644 --- a/ut/thread/ThreadBackTest.hpp +++ b/ut/thread/ThreadBackTest.hpp @@ -19,7 +19,7 @@ using namespace std; using namespace std::chrono; using namespace testing; -namespace RLib +namespace rlib { // *********************************************************************************************** struct THREAD_BACK_TEST : public Test, public UniLog