mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 14:46:12 -04:00
Fix tsan issue.
PiperOrigin-RevId: 663399817
This commit is contained in:
committed by
Copybara-Service
parent
f0115df88b
commit
f73a9120a8
@@ -86,6 +86,16 @@ void FakeNearbyConnection::SetDisconnectionListener(
|
||||
|
||||
void FakeNearbyConnection::AppendReadableData(std::vector<uint8_t> bytes) {
|
||||
NL_DCHECK(!closed_);
|
||||
if (task_runner_) {
|
||||
task_runner_->PostTask([this, bytes = std::move(bytes)]() {
|
||||
{
|
||||
absl::MutexLock lock(&read_mutex_);
|
||||
read_data_.push(std::move(bytes));
|
||||
}
|
||||
MaybeRunCallback();
|
||||
});
|
||||
return;
|
||||
}
|
||||
{
|
||||
absl::MutexLock lock(&read_mutex_);
|
||||
read_data_.push(std::move(bytes));
|
||||
|
||||
Reference in New Issue
Block a user