Flutter Engine
The Flutter Engine
third_party
dart-lang
sdk
runtime
vm
os_thread_win.h
Go to the documentation of this file.
1
// Copyright (c) 2012, 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_OS_THREAD_WIN_H_
6
#define RUNTIME_VM_OS_THREAD_WIN_H_
7
8
#if !defined(RUNTIME_VM_OS_THREAD_H_)
9
#error Do not include os_thread_win.h directly; use os_thread.h instead.
10
#endif
11
12
#include "
platform/assert.h
"
13
#include "
platform/globals.h
"
14
15
#include "
vm/allocation.h
"
16
17
namespace
dart
{
18
19
typedef
DWORD
ThreadLocalKey
;
20
typedef
DWORD
ThreadId
;
21
typedef
HANDLE
ThreadJoinId
;
22
23
static
const
ThreadLocalKey
kUnsetThreadLocalKey
=
TLS_OUT_OF_INDEXES
;
24
25
class
ThreadInlineImpl
{
26
private
:
27
ThreadInlineImpl
() {}
28
~ThreadInlineImpl
() {}
29
30
static
uword
GetThreadLocal(
ThreadLocalKey
key
) {
31
ASSERT
(
key
!=
kUnsetThreadLocalKey
);
32
return
reinterpret_cast<
uword
>
(
TlsGetValue
(
key
));
33
}
34
35
friend
class
OSThread
;
36
friend
unsigned
int
__stdcall
ThreadEntry
(
void
* data_ptr);
37
38
DISALLOW_ALLOCATION
();
39
DISALLOW_COPY_AND_ASSIGN
(
ThreadInlineImpl
);
40
};
41
42
class
MutexData
{
43
private
:
44
MutexData
() {}
45
~MutexData() {}
46
47
SRWLOCK
lock_;
48
49
friend
class
Mutex
;
50
51
DISALLOW_ALLOCATION
();
52
DISALLOW_COPY_AND_ASSIGN
(MutexData);
53
};
54
55
class
MonitorData {
56
private
:
57
MonitorData() {}
58
~MonitorData() {}
59
60
SRWLOCK
lock_;
61
CONDITION_VARIABLE cond_;
62
63
friend
class
Monitor
;
64
65
DISALLOW_ALLOCATION
();
66
DISALLOW_COPY_AND_ASSIGN
(MonitorData);
67
};
68
69
typedef
void (*
ThreadDestructor
)(
void
* parameter);
70
71
class
ThreadLocalEntry
{
72
public
:
73
ThreadLocalEntry
(
ThreadLocalKey
key
,
ThreadDestructor
destructor
)
74
: key_(
key
), destructor_(
destructor
) {}
75
76
ThreadLocalKey
key
()
const
{
return
key_; }
77
78
ThreadDestructor
destructor
()
const
{
return
destructor_; }
79
80
private
:
81
ThreadLocalKey
key_;
82
ThreadDestructor
destructor_;
83
84
DISALLOW_ALLOCATION();
85
};
86
87
template
<
typename
T>
88
class
MallocGrowableArray;
89
90
class
ThreadLocalData
:
public
AllStatic
{
91
public
:
92
static
void
RunDestructors
();
93
94
private
:
95
static
void
AddThreadLocal(
ThreadLocalKey
key
,
ThreadDestructor
destructor);
96
static
void
RemoveThreadLocal(
ThreadLocalKey
key
);
97
98
static
Mutex
* mutex_;
99
static
MallocGrowableArray<ThreadLocalEntry>
* thread_locals_;
100
101
static
void
Init();
102
static
void
Cleanup();
103
104
friend
class
OS
;
105
friend
class
OSThread
;
106
};
107
108
}
// namespace dart
109
110
#endif
// RUNTIME_VM_OS_THREAD_WIN_H_
assert.h
dart::AllStatic
Definition:
allocation.h:33
dart::MallocGrowableArray
Definition:
growable_array.h:275
dart::MonitorData::Monitor
friend class Monitor
Definition:
os_thread_absl.h:69
dart::MutexData
Definition:
os_thread_absl.h:43
dart::MutexData::Mutex
friend class Mutex
Definition:
os_thread_absl.h:52
dart::Mutex
Definition:
os_thread.h:40
dart::OSThread
Definition:
os_thread.h:86
dart::OS
Definition:
os.h:19
dart::ThreadInlineImpl
Definition:
os_thread_absl.h:27
dart::ThreadInlineImpl::ThreadEntry
friend unsigned int __stdcall ThreadEntry(void *data_ptr)
dart::ThreadLocalData
Definition:
os_thread_win.h:90
dart::ThreadLocalData::RunDestructors
static void RunDestructors()
dart::ThreadLocalEntry
Definition:
os_thread_win.h:71
dart::ThreadLocalEntry::key
ThreadLocalKey key() const
Definition:
os_thread_win.h:76
dart::ThreadLocalEntry::ThreadLocalEntry
ThreadLocalEntry(ThreadLocalKey key, ThreadDestructor destructor)
Definition:
os_thread_win.h:73
dart::ThreadLocalEntry::destructor
ThreadDestructor destructor() const
Definition:
os_thread_win.h:78
ASSERT
#define ASSERT(E)
Definition:
entrypoints_verification_test.cc:25
key
int key
Definition:
keyboard_key_handler_unittests.cc:114
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
dart::ThreadDestructor
void(* ThreadDestructor)(void *parameter)
Definition:
os_thread_win.h:69
dart::ThreadLocalKey
pthread_key_t ThreadLocalKey
Definition:
os_thread_absl.h:20
dart::kUnsetThreadLocalKey
static const ThreadLocalKey kUnsetThreadLocalKey
Definition:
os_thread_absl.h:24
dart::ThreadId
pthread_t ThreadId
Definition:
os_thread_absl.h:21
globals.h
DISALLOW_ALLOCATION
#define DISALLOW_ALLOCATION()
Definition:
globals.h:604
DISALLOW_COPY_AND_ASSIGN
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition:
globals.h:581
allocation.h
TlsGetValue
WINBASEAPI LPVOID WINAPI TlsGetValue(_In_ DWORD dwTlsIndex)
SRWLOCK
RTL_SRWLOCK SRWLOCK
Definition:
windows_types.h:106
TLS_OUT_OF_INDEXES
#define TLS_OUT_OF_INDEXES
Definition:
windows_types.h:146
HANDLE
void * HANDLE
Definition:
windows_types.h:36
DWORD
unsigned long DWORD
Definition:
windows_types.h:22
Generated on Sun Jun 23 2024 21:55:47 for Flutter Engine by
1.9.4