Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/shared/platform/win/condition_variable.cc

Issue 1221833003: Change initializer list order to match field order. (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 7
8 // See header file for description of class. 8 // See header file for description of class.
9 // There are numerous subtle implementation details in this class. See the FAQ 9 // There are numerous subtle implementation details in this class. See the FAQ
10 // comments at the end of this file for that discussion. 10 // comments at the end of this file for that discussion.
11 11
12 #include "native_client/src/include/portability.h" 12 #include "native_client/src/include/portability.h"
13 #include <stack> 13 #include <stack>
14 14
15 #include "native_client/src/shared/platform/nacl_sync.h" 15 #include "native_client/src/shared/platform/nacl_sync.h"
16 #include "native_client/src/include/nacl_macros.h" 16 #include "native_client/src/include/nacl_macros.h"
17 #include "native_client/src/shared/platform/nacl_log.h" 17 #include "native_client/src/shared/platform/nacl_log.h"
18 #include "native_client/src/shared/platform/nacl_time.h" 18 #include "native_client/src/shared/platform/nacl_time.h"
19 #include "native_client/src/shared/platform/win/condition_variable.h" 19 #include "native_client/src/shared/platform/win/condition_variable.h"
20 #include "native_client/src/shared/platform/win/lock.h" 20 #include "native_client/src/shared/platform/win/lock.h"
21 #include "native_client/src/trusted/service_runtime/include/sys/time.h" 21 #include "native_client/src/trusted/service_runtime/include/sys/time.h"
22 22
23 static const int64_t kMillisecondsPerSecond = 1000; 23 static const int64_t kMillisecondsPerSecond = 1000;
24 static const int64_t kMicrosecondsPerMillisecond = 1000; 24 static const int64_t kMicrosecondsPerMillisecond = 1000;
25 static const int64_t kMicrosecondsPerSecond = 25 static const int64_t kMicrosecondsPerSecond =
26 kMicrosecondsPerMillisecond * kMillisecondsPerSecond; 26 kMicrosecondsPerMillisecond * kMillisecondsPerSecond;
27 27
28 NaCl::ConditionVariable::ConditionVariable() 28 NaCl::ConditionVariable::ConditionVariable()
29 : run_state_(RUNNING), 29 : run_state_(RUNNING),
30 allocation_counter_(0), 30 recycling_list_size_(0),
31 recycling_list_size_(0) { 31 allocation_counter_(0) {
32 } 32 }
33 33
34 NaCl::ConditionVariable::~ConditionVariable() { 34 NaCl::ConditionVariable::~ConditionVariable() {
35 AutoLock auto_lock(internal_lock_); 35 AutoLock auto_lock(internal_lock_);
36 run_state_ = SHUTDOWN; // Prevent any more waiting. 36 run_state_ = SHUTDOWN; // Prevent any more waiting.
37 37
38 // DCHECK(recycling_list_size_ == allocation_counter_) ; 38 // DCHECK(recycling_list_size_ == allocation_counter_) ;
39 if (recycling_list_size_ != allocation_counter_) { // Rare shutdown problem. 39 if (recycling_list_size_ != allocation_counter_) { // Rare shutdown problem.
40 // User left threads Wait()ing, and is destructing us. 40 // User left threads Wait()ing, and is destructing us.
41 // Note: waiting_list_ *might* be empty, but recycling is still pending. 41 // Note: waiting_list_ *might* be empty, but recycling is still pending.
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 waiting_list. A hash table (STL map) could be used, but I was embarrased to 352 waiting_list. A hash table (STL map) could be used, but I was embarrased to
353 use a complex and relatively low efficiency container when a doubly linked list 353 use a complex and relatively low efficiency container when a doubly linked list
354 provided O(1) performance in all required operations. Since other operations 354 provided O(1) performance in all required operations. Since other operations
355 to provide performance-and/or-fairness required queue (FIFO) and list (LIFO) 355 to provide performance-and/or-fairness required queue (FIFO) and list (LIFO)
356 containers, I would also have needed to use an STL list/queue as well as an STL 356 containers, I would also have needed to use an STL list/queue as well as an STL
357 map. In the end I decided it would be "fun" to just do it right, and I 357 map. In the end I decided it would be "fun" to just do it right, and I
358 put so many assertions (DCHECKs) into the container class that it is trivial to 358 put so many assertions (DCHECKs) into the container class that it is trivial to
359 code review and validate its correctness. 359 code review and validate its correctness.
360 360
361 */ 361 */
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698