Skip to content

Commit

Permalink
atomic is not needed here since always modified in critical section, …
Browse files Browse the repository at this point in the history
…wrong assert that works in release but not debug (#594)
  • Loading branch information
qhdwight authored Oct 27, 2023
1 parent 665b597 commit 06ecd14
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/perception/zed_wrapper/zed_wrapper.bridge.cu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace mrover {
assert(bgraGpu.getWidth() >= xyzGpu.getWidth());
assert(bgraGpu.getHeight() >= xyzGpu.getHeight());
assert(bgraGpu.getChannels() == 4);
assert(xyzGpu.getChannels() == 3);
assert(xyzGpu.getChannels() == 4); // Last channel is unused
assert(msg);

auto* bgraGpuPtr = bgraGpu.getPtr<sl::uchar4>(sl::MEM::GPU);
Expand Down
2 changes: 1 addition & 1 deletion src/perception/zed_wrapper/zed_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ namespace mrover {
{
std::unique_lock lock{mSwapMutex};
// Waiting on the condition variable will drop the lock and reacquire it when the condition is met
mSwapCv.wait(lock, [this] { return mIsSwapReady.load(); });
mSwapCv.wait(lock, [this] { return mIsSwapReady; });
mIsSwapReady = false;
mPcThreadProfiler.measureEvent("Wait");

Expand Down
2 changes: 1 addition & 1 deletion src/perception/zed_wrapper/zed_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace mrover {
std::thread mPointCloudThread, mGrabThread;
std::mutex mSwapMutex;
std::condition_variable mSwapCv;
std::atomic_bool mIsSwapReady = false;
bool mIsSwapReady = false;

LoopProfiler mPcThreadProfiler{"Zed Wrapper Point Cloud"}, mGrabThreadProfiler{"Zed Wrapper Grab"};

Expand Down

0 comments on commit 06ecd14

Please sign in to comment.