File tree Expand file tree Collapse file tree 2 files changed +4
-12
lines changed
Expand file tree Collapse file tree 2 files changed +4
-12
lines changed Original file line number Diff line number Diff line change 44 * SPDX-License-Identifier: BSD-3-Clause
55 */
66// ***********************************************************************************************
7- #include < thread>
8- #include < utility>
9-
10- #include " MT_PingMainTH.hpp"
117#include " MtInQueue.hpp"
8+ #include " MT_PingMainTH.hpp"
129
1310using namespace std ;
1411
Original file line number Diff line number Diff line change @@ -141,15 +141,10 @@ bool MtInQueue::setHdlrOK(const EleHdlr& aHdlr) noexcept
141141 return false ;
142142 }
143143
144- auto && tid = std::type_index (typeid (aEleType));
145- if (tid_hdlr_S_.find (tid) != tid_hdlr_S_.end ())
146- {
144+ auto [_, ok] = tid_hdlr_S_.try_emplace (std::type_index (typeid (aEleType)), aHdlr);
145+ if (!ok)
147146 ERR (" (MtQ) failed!!! overwrite hdlr may unsafe existing data" );
148- return false ;
149- }
150-
151- tid_hdlr_S_.emplace (tid, aHdlr); // except eg bad_alloc: can't recover->terminate
152- return true ;
147+ return ok;
153148}
154149
155150
You can’t perform that action at this time.
0 commit comments