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_BIN_THREAD_LINUX_H_ |
6 | #define RUNTIME_BIN_THREAD_LINUX_H_ |
7 | |
8 | #if !defined(RUNTIME_BIN_THREAD_H_) |
9 | #error Do not include thread_linux.h directly; use thread.h instead. |
10 | #endif |
11 | |
12 | #include <pthread.h> |
13 | |
14 | #include "platform/assert.h" |
15 | #include "platform/globals.h" |
16 | |
17 | namespace dart { |
18 | namespace bin { |
19 | |
20 | typedef pthread_t ThreadId; |
21 | |
22 | class MutexData { |
23 | private: |
24 | MutexData() {} |
25 | ~MutexData() {} |
26 | |
27 | pthread_mutex_t* mutex() { return &mutex_; } |
28 | |
29 | pthread_mutex_t mutex_; |
30 | |
31 | friend class Mutex; |
32 | |
33 | DISALLOW_ALLOCATION(); |
34 | DISALLOW_COPY_AND_ASSIGN(MutexData); |
35 | }; |
36 | |
37 | class MonitorData { |
38 | private: |
39 | MonitorData() {} |
40 | ~MonitorData() {} |
41 | |
42 | pthread_mutex_t* mutex() { return &mutex_; } |
43 | pthread_cond_t* cond() { return &cond_; } |
44 | |
45 | pthread_mutex_t mutex_; |
46 | pthread_cond_t cond_; |
47 | |
48 | friend class Monitor; |
49 | |
50 | DISALLOW_ALLOCATION(); |
51 | DISALLOW_COPY_AND_ASSIGN(MonitorData); |
52 | }; |
53 | |
54 | } // namespace bin |
55 | } // namespace dart |
56 | |
57 | #endif // RUNTIME_BIN_THREAD_LINUX_H_ |
58 | |