diff --git a/cpp/platform/impl/g3/bluetooth_classic.cc b/cpp/platform/impl/g3/bluetooth_classic.cc index 4c7c7901..7af8b6c4 100644 --- a/cpp/platform/impl/g3/bluetooth_classic.cc +++ b/cpp/platform/impl/g3/bluetooth_classic.cc @@ -106,9 +106,8 @@ BluetoothDevice* BluetoothSocket::GetRemoteDevice() { std::unique_ptr BluetoothServerSocket::Accept() { absl::MutexLock lock(&mutex_); - while (pending_sockets_.empty()) { + while (!closed_ && pending_sockets_.empty()) { cond_.Wait(&mutex_); - if (closed_) break; } // whether or not we were running in the wait loop, return early if closed. if (closed_) return {};