358291589 Fix deadlock in BluetoothServerSocket::Accept.

This commit is contained in:
hai007
2021-02-19 11:29:29 -08:00
parent de83b242c5
commit 102f1e6fc3
+1 -2
View File
@@ -92,9 +92,8 @@ BluetoothDevice* BluetoothSocket::GetRemoteDevice() {
std::unique_ptr<api::BluetoothSocket> 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 {};