| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 private: | 99 private: |
| 100 Event* waitlist_; | 100 Event* waitlist_; |
| 101 Event* freelist_; | 101 Event* freelist_; |
| 102 Mutex mutex_; | 102 Mutex mutex_; |
| 103 | 103 |
| 104 DISALLOW_COPY_AND_ASSIGN(NativeHandle); | 104 DISALLOW_COPY_AND_ASSIGN(NativeHandle); |
| 105 }; | 105 }; |
| 106 #endif | 106 #endif |
| 107 | 107 |
| 108 NativeHandle& native_handle() V8_WARN_UNUSED_RESULT { | 108 NativeHandle& native_handle() { |
| 109 return native_handle_; | 109 return native_handle_; |
| 110 } | 110 } |
| 111 const NativeHandle& native_handle() const V8_WARN_UNUSED_RESULT { | 111 const NativeHandle& native_handle() const { |
| 112 return native_handle_; | 112 return native_handle_; |
| 113 } | 113 } |
| 114 | 114 |
| 115 private: | 115 private: |
| 116 NativeHandle native_handle_; | 116 NativeHandle native_handle_; |
| 117 | 117 |
| 118 DISALLOW_COPY_AND_ASSIGN(ConditionVariable); | 118 DISALLOW_COPY_AND_ASSIGN(ConditionVariable); |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 | 121 |
| 122 // POD ConditionVariable initialized lazily (i.e. the first time Pointer() is | 122 // POD ConditionVariable initialized lazily (i.e. the first time Pointer() is |
| 123 // called). | 123 // called). |
| 124 // Usage: | 124 // Usage: |
| 125 // static LazyConditionVariable my_condvar = | 125 // static LazyConditionVariable my_condvar = |
| 126 // LAZY_CONDITION_VARIABLE_INITIALIZER; | 126 // LAZY_CONDITION_VARIABLE_INITIALIZER; |
| 127 // | 127 // |
| 128 // void my_function() { | 128 // void my_function() { |
| 129 // LockGuard<Mutex> lock_guard(&my_mutex); | 129 // LockGuard<Mutex> lock_guard(&my_mutex); |
| 130 // my_condvar.Pointer()->Wait(&my_mutex); | 130 // my_condvar.Pointer()->Wait(&my_mutex); |
| 131 // } | 131 // } |
| 132 typedef LazyStaticInstance<ConditionVariable, | 132 typedef LazyStaticInstance<ConditionVariable, |
| 133 DefaultConstructTrait<ConditionVariable>, | 133 DefaultConstructTrait<ConditionVariable>, |
| 134 ThreadSafeInitOnceTrait>::type LazyConditionVariable; | 134 ThreadSafeInitOnceTrait>::type LazyConditionVariable; |
| 135 | 135 |
| 136 #define LAZY_CONDITION_VARIABLE_INITIALIZER LAZY_STATIC_INSTANCE_INITIALIZER | 136 #define LAZY_CONDITION_VARIABLE_INITIALIZER LAZY_STATIC_INSTANCE_INITIALIZER |
| 137 | 137 |
| 138 } } // namespace v8::internal | 138 } } // namespace v8::internal |
| 139 | 139 |
| 140 #endif // V8_PLATFORM_CONDITION_VARIABLE_H_ | 140 #endif // V8_PLATFORM_CONDITION_VARIABLE_H_ |
| OLD | NEW |