OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // successfully locked. | 74 // successfully locked. |
75 bool TryLock() V8_WARN_UNUSED_RESULT; | 75 bool TryLock() V8_WARN_UNUSED_RESULT; |
76 | 76 |
77 // The implementation-defined native handle type. | 77 // The implementation-defined native handle type. |
78 #if V8_OS_POSIX | 78 #if V8_OS_POSIX |
79 typedef pthread_mutex_t NativeHandle; | 79 typedef pthread_mutex_t NativeHandle; |
80 #elif V8_OS_WIN | 80 #elif V8_OS_WIN |
81 typedef CRITICAL_SECTION NativeHandle; | 81 typedef CRITICAL_SECTION NativeHandle; |
82 #endif | 82 #endif |
83 | 83 |
84 NativeHandle& native_handle() V8_WARN_UNUSED_RESULT { | 84 NativeHandle& native_handle() { |
85 return native_handle_; | 85 return native_handle_; |
86 } | 86 } |
87 const NativeHandle& native_handle() const V8_WARN_UNUSED_RESULT { | 87 const NativeHandle& native_handle() const { |
88 return native_handle_; | 88 return native_handle_; |
89 } | 89 } |
90 | 90 |
91 private: | 91 private: |
92 NativeHandle native_handle_; | 92 NativeHandle native_handle_; |
93 #ifdef DEBUG | 93 #ifdef DEBUG |
94 int level_; | 94 int level_; |
95 #endif | 95 #endif |
96 | 96 |
97 V8_INLINE(void AssertHeldAndUnmark()) { | 97 V8_INLINE(void AssertHeldAndUnmark()) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // undefined. | 170 // undefined. |
171 void Unlock(); | 171 void Unlock(); |
172 | 172 |
173 // Tries to lock the given mutex. Returns whether the mutex was | 173 // Tries to lock the given mutex. Returns whether the mutex was |
174 // successfully locked. | 174 // successfully locked. |
175 bool TryLock() V8_WARN_UNUSED_RESULT; | 175 bool TryLock() V8_WARN_UNUSED_RESULT; |
176 | 176 |
177 // The implementation-defined native handle type. | 177 // The implementation-defined native handle type. |
178 typedef Mutex::NativeHandle NativeHandle; | 178 typedef Mutex::NativeHandle NativeHandle; |
179 | 179 |
180 NativeHandle& native_handle() V8_WARN_UNUSED_RESULT { | 180 NativeHandle& native_handle() { |
181 return native_handle_; | 181 return native_handle_; |
182 } | 182 } |
183 const NativeHandle& native_handle() const V8_WARN_UNUSED_RESULT { | 183 const NativeHandle& native_handle() const { |
184 return native_handle_; | 184 return native_handle_; |
185 } | 185 } |
186 | 186 |
187 private: | 187 private: |
188 NativeHandle native_handle_; | 188 NativeHandle native_handle_; |
189 #ifdef DEBUG | 189 #ifdef DEBUG |
190 int level_; | 190 int level_; |
191 #endif | 191 #endif |
192 | 192 |
193 DISALLOW_COPY_AND_ASSIGN(RecursiveMutex); | 193 DISALLOW_COPY_AND_ASSIGN(RecursiveMutex); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 229 |
230 private: | 230 private: |
231 Mutex* mutex_; | 231 Mutex* mutex_; |
232 | 232 |
233 DISALLOW_COPY_AND_ASSIGN(LockGuard); | 233 DISALLOW_COPY_AND_ASSIGN(LockGuard); |
234 }; | 234 }; |
235 | 235 |
236 } } // namespace v8::internal | 236 } } // namespace v8::internal |
237 | 237 |
238 #endif // V8_PLATFORM_MUTEX_H_ | 238 #endif // V8_PLATFORM_MUTEX_H_ |
OLD | NEW |