/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
deps/v8/src/base/platform/condition-variable.cc
47 строк
1 KB
Michaël Zasso
deps: update V8 to 13.6.233.8
02 май 2025, 16:06
Не верифицирован
02 май 2025, 16:06
918fe04
Код
Авторство
О чём код?
// Copyright 2013 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/base/platform/condition-variable.h" #include <errno.h> #include <time.h> #include "absl/time/time.h" #include "src/base/platform/time.h" #if V8_OS_WIN #include <windows.h> #endif namespace v8 { namespace base { ConditionVariable::ConditionVariable() = default; ConditionVariable::~ConditionVariable() = default; void ConditionVariable::NotifyOne() { native_handle_.Signal(); } void ConditionVariable::NotifyAll() { native_handle_.SignalAll(); } void ConditionVariable::Wait(Mutex* mutex) { mutex->AssertHeldAndUnmark(); native_handle_.Wait(&mutex->native_handle_); mutex->AssertUnheldAndMark(); } bool ConditionVariable::WaitFor(Mutex* mutex, const TimeDelta& rel_time) { uint64_t time = rel_time.InNanoseconds(); absl::Duration duration = absl::Nanoseconds(time); mutex->AssertHeldAndUnmark(); bool timed_out = native_handle_.WaitWithTimeout(&mutex->native_handle_, duration); mutex->AssertUnheldAndMark(); return !timed_out; } } // namespace base } // namespace v8