OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #include "src/base/platform/condition-variable.h" | 5 #include "src/base/platform/condition-variable.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <time.h> | 8 #include <time.h> |
9 | 9 |
10 #include "src/base/platform/time.h" | 10 #include "src/base/platform/time.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 175 |
176 return event; | 176 return event; |
177 } | 177 } |
178 | 178 |
179 | 179 |
180 void ConditionVariable::NativeHandle::Post(Event* event, bool result) { | 180 void ConditionVariable::NativeHandle::Post(Event* event, bool result) { |
181 LockGuard<Mutex> lock_guard(&mutex_); | 181 LockGuard<Mutex> lock_guard(&mutex_); |
182 | 182 |
183 // Remove the event from the wait list. | 183 // Remove the event from the wait list. |
184 for (Event** wep = &waitlist_;; wep = &(*wep)->next_) { | 184 for (Event** wep = &waitlist_;; wep = &(*wep)->next_) { |
185 DCHECK_NE(NULL, *wep); | 185 DCHECK(*wep); |
186 if (*wep == event) { | 186 if (*wep == event) { |
187 *wep = event->next_; | 187 *wep = event->next_; |
188 break; | 188 break; |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 #ifdef DEBUG | 192 #ifdef DEBUG |
193 // The event must not be on the free list. | 193 // The event must not be on the free list. |
194 for (Event* fe = freelist_; fe != NULL; fe = fe->next_) { | 194 for (Event* fe = freelist_; fe != NULL; fe = fe->next_) { |
195 DCHECK_NE(event, fe); | 195 DCHECK_NE(event, fe); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 // Release the wait event. | 313 // Release the wait event. |
314 DCHECK(!result || event->notified_); | 314 DCHECK(!result || event->notified_); |
315 native_handle_.Post(event, result); | 315 native_handle_.Post(event, result); |
316 | 316 |
317 return result; | 317 return result; |
318 } | 318 } |
319 | 319 |
320 #endif // V8_OS_POSIX | 320 #endif // V8_OS_POSIX |
321 | 321 |
322 } } // namespace v8::base | 322 } } // namespace v8::base |
OLD | NEW |