Skip to content

Commit

Permalink
ThreadBack: inc cov
Browse files Browse the repository at this point in the history
  • Loading branch information
fchn289 committed Sep 21, 2023
1 parent 3eb4601 commit 5c6a948
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/queue/MtInQueue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class MtInQueue
ElePair pop(); // high performance
template<class aEleType> shared_ptr<aEleType> pop() { return static_pointer_cast<aEleType>(pop().first); }

void mt_wakeMainFn() { if (mt_wakeMainFn_ != nullptr) mt_wakeMainFn_(); }
void mt_wakeMainFn() { if (mt_wakeMainFn_) mt_wakeMainFn_(); }

size_t mt_size();
size_t mt_clear();
Expand Down
8 changes: 8 additions & 0 deletions ut/queue/MtInQueueTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ struct MtInQueueTest : public Test, public UniLog
};

#define FIFO
TEST_F(MtInQueueTest, GOLD_simple_fifo_without_waker)
{
MtInQueue mtQ;
mtQ.mt_push<int>(make_shared<int>(1));
mtQ.mt_push<int>(make_shared<int>(2));
EXPECT_EQ(1, *(mtQ.pop<int>())) << "REQ: fifo";
EXPECT_EQ(2, *(mtQ.pop<int>())) << "REQ: fifo";
}
TEST_F(MtInQueueTest, GOLD_sparsePush_fifo)
{
const int nMsg = 10000;
Expand Down

0 comments on commit 5c6a948

Please sign in to comment.