| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_FUTEX_EMULATION_H_ | 5 #ifndef V8_FUTEX_EMULATION_H_ |
| 6 #define V8_FUTEX_EMULATION_H_ | 6 #define V8_FUTEX_EMULATION_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| 11 #include "src/base/atomicops.h" | 11 #include "src/base/atomicops.h" |
| 12 #include "src/base/lazy-instance.h" | 12 #include "src/base/lazy-instance.h" |
| 13 #include "src/base/macros.h" | 13 #include "src/base/macros.h" |
| 14 #include "src/base/platform/condition-variable.h" | 14 #include "src/base/platform/condition-variable.h" |
| 15 #include "src/base/platform/mutex.h" | 15 #include "src/base/platform/mutex.h" |
| 16 #include "src/handles.h" | |
| 17 | 16 |
| 18 // Support for emulating futexes, a low-level synchronization primitive. They | 17 // Support for emulating futexes, a low-level synchronization primitive. They |
| 19 // are natively supported by Linux, but must be emulated for other platforms. | 18 // are natively supported by Linux, but must be emulated for other platforms. |
| 20 // This library emulates them on all platforms using mutexes and condition | 19 // This library emulates them on all platforms using mutexes and condition |
| 21 // variables for consistency. | 20 // variables for consistency. |
| 22 // | 21 // |
| 23 // This is used by the Futex API defined in the SharedArrayBuffer draft spec, | 22 // This is used by the Futex API defined in the SharedArrayBuffer draft spec, |
| 24 // found here: https://github.com/tc39/ecmascript_sharedmem | 23 // found here: https://github.com/tc39/ecmascript_sharedmem |
| 25 | 24 |
| 26 namespace v8 { | 25 namespace v8 { |
| 27 | 26 |
| 28 namespace base { | 27 namespace base { |
| 29 class TimeDelta; | 28 class TimeDelta; |
| 30 } // base | 29 } // base |
| 31 | 30 |
| 32 namespace internal { | 31 namespace internal { |
| 33 | 32 |
| 33 template <typename T> |
| 34 class Handle; |
| 34 class Isolate; | 35 class Isolate; |
| 35 class JSArrayBuffer; | 36 class JSArrayBuffer; |
| 36 | 37 |
| 37 class FutexWaitListNode { | 38 class FutexWaitListNode { |
| 38 public: | 39 public: |
| 39 FutexWaitListNode() | 40 FutexWaitListNode() |
| 40 : prev_(nullptr), | 41 : prev_(nullptr), |
| 41 next_(nullptr), | 42 next_(nullptr), |
| 42 backing_store_(nullptr), | 43 backing_store_(nullptr), |
| 43 wait_addr_(0), | 44 wait_addr_(0), |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 private: | 106 private: |
| 106 friend class FutexWaitListNode; | 107 friend class FutexWaitListNode; |
| 107 | 108 |
| 108 static base::LazyMutex mutex_; | 109 static base::LazyMutex mutex_; |
| 109 static base::LazyInstance<FutexWaitList>::type wait_list_; | 110 static base::LazyInstance<FutexWaitList>::type wait_list_; |
| 110 }; | 111 }; |
| 111 } // namespace internal | 112 } // namespace internal |
| 112 } // namespace v8 | 113 } // namespace v8 |
| 113 | 114 |
| 114 #endif // V8_FUTEX_EMULATION_H_ | 115 #endif // V8_FUTEX_EMULATION_H_ |
| OLD | NEW |