/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
deps/v8/src/tasks/operations-barrier.cc
34 строки
822 B
Michaël Zasso
deps: update V8 to 9.3.345.16
30 авг 2021, 22:02
Не верифицирован
30 авг 2021, 22:02
50930a0
Код
Авторство
О чём код?
// Copyright 2020 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "src/tasks/operations-barrier.h" namespace v8 { namespace internal { OperationsBarrier::Token OperationsBarrier::TryLock() { base::MutexGuard guard(&mutex_); if (cancelled_) return {}; ++operations_count_; return Token(this); } void OperationsBarrier::CancelAndWait() { base::MutexGuard guard(&mutex_); DCHECK(!cancelled_); cancelled_ = true; while (operations_count_ > 0) { release_condition_.Wait(&mutex_); } } void OperationsBarrier::Release() { base::MutexGuard guard(&mutex_); if (--operations_count_ == 0 && cancelled_) { release_condition_.NotifyOne(); } } } // namespace internal } // namespace v8