150 assert(dirty_size(localBot, _age.top()) != N - 1, "sanity"); |
150 assert(dirty_size(localBot, _age.top()) != N - 1, "sanity"); |
151 return false; |
151 return false; |
152 } |
152 } |
153 |
153 |
154 template<class E, MEMFLAGS F, unsigned int N> inline bool |
154 template<class E, MEMFLAGS F, unsigned int N> inline bool |
155 GenericTaskQueue<E, F, N>::pop_local(volatile E& t) { |
155 GenericTaskQueue<E, F, N>::pop_local(volatile E& t, uint threshold) { |
156 uint localBot = _bottom; |
156 uint localBot = _bottom; |
157 // This value cannot be N-1. That can only occur as a result of |
157 // This value cannot be N-1. That can only occur as a result of |
158 // the assignment to bottom in this method. If it does, this method |
158 // the assignment to bottom in this method. If it does, this method |
159 // resets the size to 0 before the next call (which is sequential, |
159 // resets the size to 0 before the next call (which is sequential, |
160 // since this is pop_local.) |
160 // since this is pop_local.) |
161 uint dirty_n_elems = dirty_size(localBot, _age.top()); |
161 uint dirty_n_elems = dirty_size(localBot, _age.top()); |
162 assert(dirty_n_elems != N - 1, "Shouldn't be possible..."); |
162 assert(dirty_n_elems != N - 1, "Shouldn't be possible..."); |
163 if (dirty_n_elems == 0) return false; |
163 if (dirty_n_elems <= threshold) return false; |
164 localBot = decrement_index(localBot); |
164 localBot = decrement_index(localBot); |
165 _bottom = localBot; |
165 _bottom = localBot; |
166 // This is necessary to prevent any read below from being reordered |
166 // This is necessary to prevent any read below from being reordered |
167 // before the store just above. |
167 // before the store just above. |
168 OrderAccess::fence(); |
168 OrderAccess::fence(); |