Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
dart-lang
sdk
runtime
vm
os_thread_absl.h
Go to the documentation of this file.
1
// Copyright (c) 2022, 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_ABSL_H_
6
#define RUNTIME_VM_OS_THREAD_ABSL_H_
7
8
#if !defined(RUNTIME_VM_OS_THREAD_H_)
9
#error Do not include os_thread_absl.h directly; use os_thread.h instead.
10
#endif
11
12
#include <pthread.h>
13
14
#include "
platform/assert.h
"
15
#include "
platform/globals.h
"
16
#include "third_party/absl/synchronization/mutex.h"
17
18
namespace
dart
{
19
20
typedef
pthread_key_t
ThreadLocalKey
;
21
typedef
pthread_t
ThreadId
;
22
typedef
pthread_t
ThreadJoinId
;
23
24
static
const
ThreadLocalKey
kUnsetThreadLocalKey
=
25
static_cast<
pthread_key_t
>
(-1);
26
27
class
ThreadInlineImpl
{
28
private
:
29
ThreadInlineImpl
() {}
30
~ThreadInlineImpl
() {}
31
32
static
uword
GetThreadLocal(
ThreadLocalKey
key
) {
33
ASSERT
(
key
!=
kUnsetThreadLocalKey
);
34
return
reinterpret_cast<
uword
>
(pthread_getspecific(
key
));
35
}
36
37
friend
class
OSThread
;
38
39
DISALLOW_ALLOCATION
();
40
DISALLOW_COPY_AND_ASSIGN
(
ThreadInlineImpl
);
41
};
42
43
class
MutexData
{
44
private
:
45
MutexData
() : mutex_() {}
46
~MutexData
() {}
47
48
absl::Mutex* mutex() {
return
&mutex_; }
49
50
absl::Mutex mutex_;
51
52
friend
class
Mutex
;
53
54
DISALLOW_ALLOCATION
();
55
DISALLOW_COPY_AND_ASSIGN
(
MutexData
);
56
};
57
58
class
MonitorData
{
59
private
:
60
MonitorData
() : mutex_(), cond_() {}
61
~MonitorData
() {}
62
63
absl::Mutex* mutex() {
return
&mutex_; }
64
absl::CondVar* cond() {
return
&cond_; }
65
66
absl::Mutex mutex_;
67
absl::CondVar cond_;
68
69
friend
class
Monitor
;
70
71
DISALLOW_ALLOCATION
();
72
DISALLOW_COPY_AND_ASSIGN
(
MonitorData
);
73
};
74
75
}
// namespace dart
76
77
#endif
// RUNTIME_VM_OS_THREAD_ABSL_H_
assert.h
dart::MonitorData
Definition
os_thread_absl.h:58
dart::Monitor
Definition
os_thread.h:356
dart::MutexData
Definition
os_thread_absl.h:43
dart::Mutex
Definition
os_thread.h:40
dart::OSThread
Definition
os_thread.h:86
dart::ThreadInlineImpl
Definition
os_thread_absl.h:27
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::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
Generated on Fri Apr 26 2024 06:15:16 for Flutter Engine by
1.9.8