OLD | NEW |
---|---|
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 28 matching lines...) Expand all Loading... | |
39 // consumer. Doesn't have restrictions on the number of queued | 39 // consumer. Doesn't have restrictions on the number of queued |
40 // elements, so producer never blocks. Implemented after Herb | 40 // elements, so producer never blocks. Implemented after Herb |
41 // Sutter's article: | 41 // Sutter's article: |
42 // http://www.ddj.com/high-performance-computing/210604448 | 42 // http://www.ddj.com/high-performance-computing/210604448 |
43 template<typename Record> | 43 template<typename Record> |
44 class UnboundQueue BASE_EMBEDDED { | 44 class UnboundQueue BASE_EMBEDDED { |
45 public: | 45 public: |
46 inline UnboundQueue(); | 46 inline UnboundQueue(); |
47 inline ~UnboundQueue(); | 47 inline ~UnboundQueue(); |
48 | 48 |
49 INLINE(void Dequeue(Record* rec)); | 49 INLINE(bool Dequeue(Record* rec)); |
50 INLINE(void Enqueue(const Record& rec)); | 50 INLINE(void Enqueue(const Record& rec)); |
51 INLINE(bool IsEmpty()) { return divider_ == last_; } | 51 INLINE(bool IsEmpty()) { return divider_ == last_; } |
Dmitry Vyukov
2013/06/17 19:51:57
this must use NoBarrier_Load's
yurys
2013/06/18 08:01:00
Done.
| |
52 INLINE(Record* Peek()); | 52 INLINE(Record* Peek()); |
53 | 53 |
54 private: | 54 private: |
55 INLINE(void DeleteFirst()); | 55 INLINE(void DeleteFirst()); |
56 | 56 |
57 struct Node; | 57 struct Node; |
58 | 58 |
59 Node* first_; | 59 Node* first_; |
60 AtomicWord divider_; // Node* | 60 AtomicWord divider_; // Node* |
61 AtomicWord last_; // Node* | 61 AtomicWord last_; // Node* |
62 | 62 |
63 DISALLOW_COPY_AND_ASSIGN(UnboundQueue); | 63 DISALLOW_COPY_AND_ASSIGN(UnboundQueue); |
64 }; | 64 }; |
65 | 65 |
66 | 66 |
67 } } // namespace v8::internal | 67 } } // namespace v8::internal |
68 | 68 |
69 #endif // V8_UNBOUND_QUEUE_ | 69 #endif // V8_UNBOUND_QUEUE_ |
OLD | NEW |