Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
os_thread_macos.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_MACOS_H_
6#define RUNTIME_VM_OS_THREAD_MACOS_H_
7
8#if !defined(RUNTIME_VM_OS_THREAD_H_)
9#error Do not include os_thread_macos.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
17namespace dart {
18
19typedef pthread_key_t ThreadLocalKey;
20typedef pthread_t ThreadId;
21typedef pthread_t ThreadJoinId;
22
24 static_cast<pthread_key_t>(-1);
25
26class ThreadInlineImpl {
27 private:
30
31 static uword GetThreadLocal(ThreadLocalKey key) {
32 static ThreadLocalKey kUnsetThreadLocalKey = static_cast<pthread_key_t>(-1);
34 return reinterpret_cast<uword>(pthread_getspecific(key));
35 }
36
37 friend class OSThread;
38
41};
42
43class MutexData {
44 private:
45 MutexData() {}
46 ~MutexData() {}
47
48 pthread_mutex_t* mutex() { return &mutex_; }
49
50 pthread_mutex_t mutex_;
51
52 friend class Mutex;
53
55 DISALLOW_COPY_AND_ASSIGN(MutexData);
56};
57
58class MonitorData {
59 private:
60 MonitorData() {}
61 ~MonitorData() {}
62
63 pthread_mutex_t* mutex() { return &mutex_; }
64 pthread_cond_t* cond() { return &cond_; }
65
66 pthread_mutex_t mutex_;
67 pthread_cond_t cond_;
68
69 friend class Monitor;
70
72 DISALLOW_COPY_AND_ASSIGN(MonitorData);
73};
74
75} // namespace dart
76
77#endif // RUNTIME_VM_OS_THREAD_MACOS_H_
friend class Monitor
friend class Mutex
#define ASSERT(E)
pthread_t ThreadJoinId
uintptr_t uword
Definition globals.h:501
pthread_key_t ThreadLocalKey
static const ThreadLocalKey kUnsetThreadLocalKey
pthread_t ThreadId
#define DISALLOW_ALLOCATION()
Definition globals.h:604
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition globals.h:581