Skip to content

Commit

Permalink
lcm: Prime the LCM self-test before launching threads
Browse files Browse the repository at this point in the history
  • Loading branch information
jwnimmer-tri committed Oct 30, 2018
1 parent 83a5f83 commit d366845
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lcm/drake_lcm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ DrakeLcm::~DrakeLcm() { receive_thread_.reset(); }

void DrakeLcm::StartReceiveThread() {
DRAKE_DEMAND(receive_thread_ == nullptr);

// Ensure that LCM's self-test happens before our thread starts running.
// Without this, ThreadSanitizer builds may report false positives related to
// the self-test happening concurrently with the LCM publishing.
lcm_.getFileno();

// Now launch the thread.
receive_thread_ = std::make_unique<LcmReceiveThread>(&lcm_);
}

Expand Down

0 comments on commit d366845

Please sign in to comment.