Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dd505848 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes Ie7da9884,Id3d3159e

* changes:
  Do not unregister messages in HciLayer::Stop
  Do not delete executing_reactable_finished_ from multiple contexts
parents bbb19406 d06f7650
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -234,12 +234,6 @@ struct HciLayer::impl : public hal::HciHalCallbacks {

  void Stop() {
    hal_->unregisterIncomingPacketCallback();
    UnregisterEventHandler(EventCode::COMMAND_COMPLETE);
    UnregisterEventHandler(EventCode::COMMAND_STATUS);
    UnregisterEventHandler(EventCode::LE_META_EVENT);
    UnregisterEventHandler(EventCode::PAGE_SCAN_REPETITION_MODE_CHANGE);
    UnregisterEventHandler(EventCode::MAX_SLOTS_CHANGE);
    UnregisterEventHandler(EventCode::VENDOR_SPECIFIC);

    acl_queue_.GetDownEnd()->UnregisterDequeue();
    incoming_acl_packet_buffer_.Clear();
+4 −3
Original line number Diff line number Diff line
@@ -105,6 +105,7 @@ void Reactor::Run() {
      }
      auto* reactable = static_cast<Reactor::Reactable*>(event.data.ptr);
      std::unique_lock<std::mutex> lock(mutex_);
      executing_reactable_finished_ = nullptr;
      // See if this reactable has been removed in the meantime.
      if (std::find(invalidation_list_.begin(), invalidation_list_.end(), reactable) != invalidation_list_.end()) {
        continue;
@@ -194,11 +195,11 @@ void Reactor::Unregister(Reactor::Reactable* reactable) {

bool Reactor::WaitForUnregisteredReactable(std::chrono::milliseconds timeout) {
  std::lock_guard<std::mutex> lock(mutex_);
  if (executing_reactable_finished_ == nullptr) {
  std::shared_ptr<std::future<void>> reactable_finished_future = executing_reactable_finished_;
  if (reactable_finished_future == nullptr) {
    return true;
  }
  auto stop_status = executing_reactable_finished_->wait_for(timeout);
  executing_reactable_finished_ = nullptr;
  auto stop_status = reactable_finished_future->wait_for(timeout);
  if (stop_status != std::future_status::ready) {
    LOG_ERROR("Unregister reactable timed out");
  }
+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ class Reactor {
  int control_fd_;
  std::atomic<bool> is_running_;
  std::list<Reactable*> invalidation_list_;
  std::unique_ptr<std::future<void>> executing_reactable_finished_;
  std::shared_ptr<std::future<void>> executing_reactable_finished_;
};

}  // namespace os