Skip to content

Commit

Permalink
winusb: DriverHost_PX4: cfe0712 の変更によるバグを修正
Browse files Browse the repository at this point in the history
チューナーがまったく開けなくなってしまったので修正
  • Loading branch information
nns779 committed Sep 9, 2021
1 parent cfe0712 commit 7fa9f05
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions winusb/src/DriverHost_PX4/receiver_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static GUID empty_guid = { 0 };

px4::ReceiverBase* ReceiverManager::SearchAndOpen(px4::command::ReceiverInfo &key, px4::command::ReceiverInfo &info, std::uint32_t &data_id)
{
std::shared_lock<std::shared_mutex> lock(mtx_);
std::lock_guard<std::shared_mutex> lock(mtx_);

for (auto it = data_.cbegin(); it != data_.cend(); ++it) {
const px4::command::ReceiverInfo& k = it->second.info;
Expand Down Expand Up @@ -93,8 +93,6 @@ px4::ReceiverBase* ReceiverManager::SearchByDataId(std::uint32_t data_id)

bool ReceiverManager::GenerateDataId(px4::ReceiverBase *receiver, std::uint32_t &data_id)
{
std::lock_guard<std::shared_mutex> lock(mtx_);

if (!data_.count(receiver))
return false;

Expand Down
3 changes: 2 additions & 1 deletion winusb/src/DriverHost_PX4/receiver_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class ReceiverManager final {
bool Unregister(px4::ReceiverBase *receiver);
px4::ReceiverBase* SearchAndOpen(px4::command::ReceiverInfo &key, px4::command::ReceiverInfo &info, std::uint32_t &data_id);
px4::ReceiverBase* SearchByDataId(std::uint32_t data_id);
bool GenerateDataId(px4::ReceiverBase *receiver, std::uint32_t &data_id);
void ClearDataId(px4::ReceiverBase *receiver);

private:
Expand All @@ -36,6 +35,8 @@ class ReceiverManager final {
bool valid_data_id;
};

bool GenerateDataId(px4::ReceiverBase *receiver, std::uint32_t &data_id);

std::shared_mutex mtx_;
std::unordered_map<px4::ReceiverBase*, ReceiverData> data_;
};
Expand Down

0 comments on commit 7fa9f05

Please sign in to comment.