v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
condition-variable.cc
Go to the documentation of this file.
1// Copyright 2013 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
6
7#include <errno.h>
8#include <time.h>
9
10#include "absl/time/time.h"
12
13#if V8_OS_WIN
14#include <windows.h>
15#endif
16
17namespace v8 {
18namespace base {
19
22
24
26
28 mutex->AssertHeldAndUnmark();
29 native_handle_.Wait(&mutex->native_handle_);
30 mutex->AssertUnheldAndMark();
31}
32
34 uint64_t time = rel_time.InNanoseconds();
35 absl::Duration duration = absl::Nanoseconds(time);
36
37 mutex->AssertHeldAndUnmark();
38 bool timed_out =
39 native_handle_.WaitWithTimeout(&mutex->native_handle_, duration);
40
41 mutex->AssertUnheldAndMark();
42
43 return !timed_out;
44}
45
46} // namespace base
47} // namespace v8
bool WaitFor(Mutex *mutex, const TimeDelta &rel_time) V8_WARN_UNUSED_RESULT
int64_t InNanoseconds() const
Definition time.cc:259
base::Mutex mutex