| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PLATFORM_THREAD_MACOS_H_ | 5 #ifndef PLATFORM_THREAD_MACOS_H_ |
| 6 #define PLATFORM_THREAD_MACOS_H_ | 6 #define PLATFORM_THREAD_MACOS_H_ |
| 7 | 7 |
| 8 #if !defined(PLATFORM_THREAD_H_) | 8 #if !defined(PLATFORM_THREAD_H_) |
| 9 #error Do not include thread_macos.h directly; use thread.h instead. | 9 #error Do not include thread_macos.h directly; use thread.h instead. |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #include <pthread.h> | 12 #include <pthread.h> |
| 13 | 13 |
| 14 #include "platform/globals.h" | 14 #include "platform/globals.h" |
| 15 | 15 |
| 16 namespace dart { | 16 namespace dart { |
| 17 | 17 |
| 18 typedef pthread_key_t ThreadLocalKey; |
| 19 |
| 20 class ThreadInlineImpl { |
| 21 private: |
| 22 ThreadInlineImpl() {} |
| 23 ~ThreadInlineImpl() {} |
| 24 |
| 25 static uword GetThreadLocal(ThreadLocalKey key) { |
| 26 static ThreadLocalKey kUnsetThreadLocalKey = static_cast<pthread_key_t>(-1); |
| 27 ASSERT(key != kUnsetThreadLocalKey); |
| 28 return reinterpret_cast<uword>(pthread_getspecific(key)); |
| 29 } |
| 30 |
| 31 friend class Thread; |
| 32 |
| 33 DISALLOW_ALLOCATION(); |
| 34 DISALLOW_COPY_AND_ASSIGN(ThreadInlineImpl); |
| 35 }; |
| 36 |
| 37 |
| 18 class MutexData { | 38 class MutexData { |
| 19 private: | 39 private: |
| 20 MutexData() {} | 40 MutexData() {} |
| 21 ~MutexData() {} | 41 ~MutexData() {} |
| 22 | 42 |
| 23 pthread_mutex_t* mutex() { return &mutex_; } | 43 pthread_mutex_t* mutex() { return &mutex_; } |
| 24 | 44 |
| 25 pthread_mutex_t mutex_; | 45 pthread_mutex_t mutex_; |
| 26 | 46 |
| 27 friend class Mutex; | 47 friend class Mutex; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 44 | 64 |
| 45 friend class Monitor; | 65 friend class Monitor; |
| 46 | 66 |
| 47 DISALLOW_ALLOCATION(); | 67 DISALLOW_ALLOCATION(); |
| 48 DISALLOW_COPY_AND_ASSIGN(MonitorData); | 68 DISALLOW_COPY_AND_ASSIGN(MonitorData); |
| 49 }; | 69 }; |
| 50 | 70 |
| 51 } // namespace dart | 71 } // namespace dart |
| 52 | 72 |
| 53 #endif // PLATFORM_THREAD_MACOS_H_ | 73 #endif // PLATFORM_THREAD_MACOS_H_ |
| OLD | NEW |