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

Commit c82ce8a7 authored by Tianyu Jiang's avatar Tianyu Jiang Committed by Android (Google) Code Review
Browse files

Merge "Fix race condition between ProducerQueue dequeue and ConsumerQueue...

Merge "Fix race condition between ProducerQueue dequeue and ConsumerQueue dequeue newly allocated buffer."
parents 4a307b67 ca9201a9
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -311,8 +311,11 @@ Status<RemoteChannelHandle> ProducerChannel::CreateConsumer(Message& message) {
    return ErrorStatus(ENOMEM);
  }

  if (!producer_owns_ && !BufferHubDefs::IsBufferReleased(
                             buffer_state_->load(std::memory_order_acquire))) {
  uint64_t current_buffer_state =
      buffer_state_->load(std::memory_order_acquire);
  if (!producer_owns_ &&
      (BufferHubDefs::IsBufferPosted(current_buffer_state) ||
       BufferHubDefs::IsBufferAcquired(current_buffer_state))) {
    // Signal the new consumer when adding it to a posted producer.
    if (consumer->OnProducerPosted())
      pending_consumers_++;