forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplatform.cc
More file actions
35 lines (26 loc) · 802 Bytes
/
platform.cc
File metadata and controls
35 lines (26 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2023 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/platform.h"
namespace v8 {
namespace base {
namespace {
// A pointer to current thread's stack beginning.
thread_local void* thread_stack_start = nullptr;
} // namespace
// static
Stack::StackSlot Stack::GetStackStartUnchecked() {
if (!thread_stack_start) {
thread_stack_start = ObtainCurrentThreadStackStart();
}
return thread_stack_start;
}
// static
Stack::StackSlot Stack::GetStackStart() { return GetStackStartUnchecked(); }
// static
int OS::GetCurrentThreadId() {
static thread_local int id = GetCurrentThreadIdInternal();
return id;
}
} // namespace base
} // namespace v8