Skip to content

Commit

Permalink
removed accidental test race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
kmactavish committed Aug 12, 2017
1 parent e6aa520 commit 507299f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/test_roscpp/test/test_callback_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,8 @@ void ConditionObject::add()
{
while(!condition_stop.load())
{
if(condition_sync.load())
if(condition_sync.load() && queue->isEmpty())
{
condition_sync.store(false);
condition_one.store(true);
id++;
queue->addCallback(boost::make_shared<RaceConditionCallback>(this, &id), id);
Expand All @@ -458,6 +457,7 @@ TEST(CallbackQueue, raceConditionCallback)
boost::thread t(boost::bind(&ConditionObject::add, &condition_object));
for(unsigned int i = 0; i < 1000000; ++i)
{
condition_object.condition_sync.store(false);
if (queue.callOne() == CallbackQueue::Called)
{
if(condition_object.condition_one.load())
Expand Down

0 comments on commit 507299f

Please sign in to comment.