v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
platform-win32.h
Go to the documentation of this file.
1
// Copyright 2023 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
5
#ifndef V8_BASE_PLATFORM_PLATFORM_WIN32_H_
6
#define V8_BASE_PLATFORM_PLATFORM_WIN32_H_
7
8
#include "
src/base/platform/time.h
"
9
10
namespace
v8
{
11
namespace
base
{
12
13
// A timer which allows more precise sleep intervals. Sleeping on Windows is
14
// generally limited by the granularity of the system timer (64 Hz by default),
15
// but on Windows 10 version 1803 and newer, this class allows much shorter
16
// sleeps including sub-millisecond intervals.
17
class
V8_BASE_EXPORT
PreciseSleepTimer
{
18
public
:
19
PreciseSleepTimer
();
20
~PreciseSleepTimer
();
21
22
// Moving is supported but copying is not, because this class owns a
23
// platform handle.
24
PreciseSleepTimer
(
const
PreciseSleepTimer
& other) =
delete
;
25
PreciseSleepTimer
&
operator=
(
const
PreciseSleepTimer
& other) =
delete
;
26
PreciseSleepTimer
(
PreciseSleepTimer
&& other)
V8_NOEXCEPT
;
27
PreciseSleepTimer
& operator=(
PreciseSleepTimer
&& other)
V8_NOEXCEPT
;
28
29
// Attempts to initialize this timer. Precise timers are only available on
30
// Windows 10 version 1803 and later. To check whether initialization worked,
31
// use IsInitialized.
32
void
TryInit();
33
34
bool
IsInitialized()
const
;
35
36
// Sleeps for a specified time interval. This function requires that the timer
37
// has been initialized, as can be checked with IsInitialized. A single
38
// PreciseSleepTimer instance must not be used simultaneously on multiple
39
// threads.
40
void
Sleep(
TimeDelta
interval)
const
;
41
42
private
:
43
void
Close();
44
HANDLE
timer_
;
45
};
46
47
}
// namespace base
48
}
// namespace v8
49
50
#endif
// V8_BASE_PLATFORM_PLATFORM_WIN32_H_
V8_BASE_EXPORT
#define V8_BASE_EXPORT
Definition
base-export.h:26
v8::base::PreciseSleepTimer
Definition
platform-win32.h:17
v8::base::PreciseSleepTimer::timer_
HANDLE timer_
Definition
platform-win32.h:44
v8::base::PreciseSleepTimer::operator=
PreciseSleepTimer & operator=(const PreciseSleepTimer &other)=delete
v8::base::PreciseSleepTimer::PreciseSleepTimer
PreciseSleepTimer(const PreciseSleepTimer &other)=delete
v8::base::TimeDelta
Definition
time.h:67
base
OpIndex base
Definition
instruction-selector-ia32.cc:65
v8
Definition
api-arguments-inl.h:19
V8_NOEXCEPT
#define V8_NOEXCEPT
Definition
compiler-specific.h:105
time.h
HANDLE
void * HANDLE
Definition
win32-headers.h:56
src
base
platform
platform-win32.h
Generated on Sun Apr 6 2025 21:08:50 for v8 by
1.12.0