
Untitled
By: a guest on
Oct 15th, 2010 | syntax:
C++ | size: 0.29 KB | hits: 70 | expires: Never
std::shared_ptr<T> pop()
{
++threads_in_pop;
node* old_head=head; #1
while(old_head && !head.compare_exchange_weak(old_head,old_head->next)); #3
std::shared_ptr<T> res;
if(old_head)
{
res.swap(old_head->data);
}
try_reclaim(old_head); #2
return res;
}