Skip to content

Commit

Permalink
ThreadBack: fix race found by tsan
Browse files Browse the repository at this point in the history
  • Loading branch information
fchn289 committed Jan 31, 2024
1 parent fcca6d6 commit 8883732
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/log/UniCoutLog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
//
// - CORE:
// . cout
//
// - NOT MT safe: since (static) member; so shall ONLY use in main thread
// ***********************************************************************************************
#ifndef UNI_COUT_LOG_HPP_
#define UNI_COUT_LOG_HPP_
Expand Down
2 changes: 2 additions & 0 deletions src/log/UniSmartLog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
//
// - CORE:
// . smartLog_
//
// - NOT MT safe: since (static) member; so shall ONLY use in main thread
// ***********************************************************************************************
#ifndef UNI_SMART_LOG_HPP_
#define UNI_SMART_LOG_HPP_
Expand Down
2 changes: 1 addition & 1 deletion ut/thread/ThreadBackTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ TEST_F(ThreadBackTest, GOLD_entryFn_inNewThread_thenBackFn_inMainThread_withSema
{
EXPECT_NE(this_thread::get_id(), mt_threadID) << "REQ: in new thread";
mt_threadID = this_thread::get_id();
DBG("MT_ThreadEntryFN(): thread id=" << mt_threadID);
HID("MT_ThreadEntryFN(): thread id=" << mt_threadID); // not MT safe but debug only
return true;
},
// ThreadBackFN
Expand Down

0 comments on commit 8883732

Please sign in to comment.