Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
dart-lang
sdk
runtime
vm
thread_interrupter.h
Go to the documentation of this file.
1
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2
// for details. All rights reserved. Use of this source code is governed by a
3
// BSD-style license that can be found in the LICENSE file.
4
5
#ifndef RUNTIME_VM_THREAD_INTERRUPTER_H_
6
#define RUNTIME_VM_THREAD_INTERRUPTER_H_
7
8
#include "
vm/allocation.h
"
9
#include "
vm/os_thread.h
"
10
#include "
vm/signal_handler.h
"
11
#include "
vm/thread.h
"
12
13
namespace
dart
{
14
15
struct
InterruptedThreadState
{
16
uintptr_t
pc
;
17
uintptr_t
csp
;
18
uintptr_t
dsp
;
19
uintptr_t
fp
;
20
uintptr_t
lr
;
21
};
22
23
class
ThreadInterrupter
:
public
AllStatic
{
24
public
:
25
static
void
Init
();
26
27
static
void
Startup
();
28
static
void
Cleanup
();
29
30
// Delay between interrupts.
31
static
void
SetInterruptPeriod
(intptr_t period);
32
33
// Wake up the thread interrupter thread.
34
static
void
WakeUp
();
35
36
// Interrupt a thread.
37
static
void
InterruptThread
(
OSThread
* thread);
38
39
// Prepare current thread for handling interrupts. Returns
40
// opaque pointer to the allocated state (if any).
41
static
void
*
PrepareCurrentThread
();
42
43
// Cleanup any state which was created by |PrepareCurrentThread|.
44
static
void
CleanupCurrentThreadState
(
void
*
state
);
45
46
private
:
47
static
constexpr
intptr_t kMaxThreads = 4096;
48
static
bool
initialized_;
49
static
bool
shutdown_;
50
static
bool
thread_running_;
51
static
bool
woken_up_;
52
static
ThreadJoinId
interrupter_thread_id_;
53
static
Monitor
* monitor_;
54
static
intptr_t interrupt_period_;
55
static
intptr_t current_wait_time_;
56
57
static
bool
InDeepSleep() {
58
return
current_wait_time_ ==
Monitor::kNoTimeout
;
59
}
60
61
static
void
ThreadMain(
uword
parameters);
62
63
static
void
InstallSignalHandler();
64
65
static
void
RemoveSignalHandler();
66
67
friend
class
ThreadInterrupterVisitIsolates
;
68
};
69
70
}
// namespace dart
71
72
#endif
// RUNTIME_VM_THREAD_INTERRUPTER_H_
dart::AllStatic
Definition
allocation.h:33
dart::Monitor
Definition
os_thread.h:356
dart::Monitor::kNoTimeout
static constexpr int64_t kNoTimeout
Definition
os_thread.h:360
dart::OSThread
Definition
os_thread.h:86
dart::ThreadInterrupter
Definition
thread_interrupter.h:23
dart::ThreadInterrupter::Startup
static void Startup()
Definition
thread_interrupter.cc:64
dart::ThreadInterrupter::ThreadInterrupterVisitIsolates
friend class ThreadInterrupterVisitIsolates
Definition
thread_interrupter.h:67
dart::ThreadInterrupter::WakeUp
static void WakeUp()
Definition
thread_interrupter.cc:125
dart::ThreadInterrupter::CleanupCurrentThreadState
static void CleanupCurrentThreadState(void *state)
Definition
thread_interrupter.cc:238
dart::ThreadInterrupter::Init
static void Init()
Definition
thread_interrupter.cc:54
dart::ThreadInterrupter::SetInterruptPeriod
static void SetInterruptPeriod(intptr_t period)
Definition
thread_interrupter.cc:111
dart::ThreadInterrupter::Cleanup
static void Cleanup()
Definition
thread_interrupter.cc:83
dart::ThreadInterrupter::PrepareCurrentThread
static void * PrepareCurrentThread()
Definition
thread_interrupter.cc:234
dart::ThreadInterrupter::InterruptThread
static void InterruptThread(OSThread *thread)
state
AtkStateType state
Definition
fl_accessible_node.cc:10
dart
Definition
dart_vm.cc:33
dart::ThreadJoinId
pthread_t ThreadJoinId
Definition
os_thread_absl.h:22
dart::uword
uintptr_t uword
Definition
globals.h:501
os_thread.h
signal_handler.h
dart::InterruptedThreadState
Definition
thread_interrupter.h:15
dart::InterruptedThreadState::dsp
uintptr_t dsp
Definition
thread_interrupter.h:18
dart::InterruptedThreadState::csp
uintptr_t csp
Definition
thread_interrupter.h:17
dart::InterruptedThreadState::lr
uintptr_t lr
Definition
thread_interrupter.h:20
dart::InterruptedThreadState::fp
uintptr_t fp
Definition
thread_interrupter.h:19
dart::InterruptedThreadState::pc
uintptr_t pc
Definition
thread_interrupter.h:16
allocation.h
thread.h
Generated on Fri Apr 26 2024 06:15:19 for Flutter Engine by
1.9.8