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

Side by Side Diff: src/IceThreading.h

Issue 1221643012: Subzero: Add -Wshadow to the build. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes 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
OLDNEW
1 //===- subzero/src/IceThreading.h - Threading functions ---------*- C++ -*-===// 1 //===- subzero/src/IceThreading.h - Threading functions ---------*- C++ -*-===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 /// MaxStaticSize, where the queue boundaries are denoted by the Front 48 /// MaxStaticSize, where the queue boundaries are denoted by the Front
49 /// and Back fields. Front==Back indicates an empty queue. 49 /// and Back fields. Front==Back indicates an empty queue.
50 template <typename T, size_t MaxStaticSize = 128> 50 template <typename T, size_t MaxStaticSize = 128>
51 class BoundedProducerConsumerQueue { 51 class BoundedProducerConsumerQueue {
52 BoundedProducerConsumerQueue() = delete; 52 BoundedProducerConsumerQueue() = delete;
53 BoundedProducerConsumerQueue(const BoundedProducerConsumerQueue &) = delete; 53 BoundedProducerConsumerQueue(const BoundedProducerConsumerQueue &) = delete;
54 BoundedProducerConsumerQueue & 54 BoundedProducerConsumerQueue &
55 operator=(const BoundedProducerConsumerQueue &) = delete; 55 operator=(const BoundedProducerConsumerQueue &) = delete;
56 56
57 public: 57 public:
58 BoundedProducerConsumerQueue(bool Sequential, size_t MaxSize = MaxStaticSize) 58 BoundedProducerConsumerQueue(bool MySequential,
59 : MaxSize(std::min(MaxSize, MaxStaticSize)), Sequential(Sequential) {} 59 size_t MyMaxSize = MaxStaticSize)
60 : MaxSize(std::min(MyMaxSize, MaxStaticSize)), Sequential(MySequential) {}
60 void blockingPush(T *Item) { 61 void blockingPush(T *Item) {
61 { 62 {
62 std::unique_lock<GlobalLockType> L(Lock); 63 std::unique_lock<GlobalLockType> L(Lock);
63 // If the work queue is already "full", wait for a consumer to 64 // If the work queue is already "full", wait for a consumer to
64 // grab an element and shrink the queue. 65 // grab an element and shrink the queue.
65 Shrunk.wait(L, [this] { return size() < MaxSize || Sequential; }); 66 Shrunk.wait(L, [this] { return size() < MaxSize || Sequential; });
66 push(Item); 67 push(Item);
67 } 68 }
68 GrewOrEnded.notify_one(); 69 GrewOrEnded.notify_one();
69 } 70 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 const uint32_t Sequence; 200 const uint32_t Sequence;
200 const ItemKind Kind; 201 const ItemKind Kind;
201 std::unique_ptr<VariableDeclarationList> GlobalInits; 202 std::unique_ptr<VariableDeclarationList> GlobalInits;
202 std::unique_ptr<Assembler> Function; 203 std::unique_ptr<Assembler> Function;
203 std::unique_ptr<Cfg> RawFunc; 204 std::unique_ptr<Cfg> RawFunc;
204 }; 205 };
205 206
206 } // end of namespace Ice 207 } // end of namespace Ice
207 208
208 #endif // SUBZERO_SRC_ICETHREADING_H 209 #endif // SUBZERO_SRC_ICETHREADING_H
OLDNEW
« src/IceInst.h ('K') | « src/IceTargetLoweringX86BaseImpl.h ('k') | src/IceTimerTree.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698