< prev index next >

src/hotspot/share/utilities/lockFreeStack.hpp

Print this page




 153   // pops while the length is being determined.
 154   size_t length() const {
 155     size_t result = 0;
 156     for (const T* current = top(); current != NULL; current = next(*current)) {
 157       ++result;
 158     }
 159     return result;
 160   }
 161 
 162   // Return the entry following value in the list used by the
 163   // specialized LockFreeStack class.
 164   static T* next(const T& value) {
 165     return Atomic::load(next_ptr(const_cast<T&>(value)));
 166   }
 167 
 168   // Set the entry following value to new_next in the list used by the
 169   // specialized LockFreeStack class.  Not thread-safe; in particular,
 170   // if value is in an instance of this specialization of LockFreeStack,
 171   // there must be no concurrent push or pop operations on that stack.
 172   static void set_next(T& value, T* new_next) {
 173     Atomic::store(new_next, next_ptr(value));
 174   }
 175 };
 176 
 177 #endif // SHARE_UTILITIES_LOCKFREESTACK_HPP


 153   // pops while the length is being determined.
 154   size_t length() const {
 155     size_t result = 0;
 156     for (const T* current = top(); current != NULL; current = next(*current)) {
 157       ++result;
 158     }
 159     return result;
 160   }
 161 
 162   // Return the entry following value in the list used by the
 163   // specialized LockFreeStack class.
 164   static T* next(const T& value) {
 165     return Atomic::load(next_ptr(const_cast<T&>(value)));
 166   }
 167 
 168   // Set the entry following value to new_next in the list used by the
 169   // specialized LockFreeStack class.  Not thread-safe; in particular,
 170   // if value is in an instance of this specialization of LockFreeStack,
 171   // there must be no concurrent push or pop operations on that stack.
 172   static void set_next(T& value, T* new_next) {
 173     Atomic::store(next_ptr(value), new_next);
 174   }
 175 };
 176 
 177 #endif // SHARE_UTILITIES_LOCKFREESTACK_HPP
< prev index next >