You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just like an object factory, the oldPNode.soNext(head) can ensure correct construction.
@Override
public int fill(Supplier<E> s, int limit)
{
if (null == s)
throw new IllegalArgumentException("supplier is null");
if (limit < 0)
throw new IllegalArgumentException("limit is negative:" + limit);
if (limit == 0)
return 0;
LinkedQueueNode<E> tail = newNode(s.get());
final LinkedQueueNode<E> head = tail;
for (int i = 1; i < limit; i++)
{
final LinkedQueueNode<E> temp = newNode(s.get());
// The fence here may be redundant
tail.soNext(temp);
tail = temp;
}
final LinkedQueueNode<E> oldPNode = lpProducerNode();
oldPNode.soNext(head);
spProducerNode(tail);
return limit;
}
The text was updated successfully, but these errors were encountered:
@Override
public int fill(Supplier<E> s, int limit)
{
if (null == s)
throw new IllegalArgumentException("supplier is null");
if (limit < 0)
throw new IllegalArgumentException("limit is negative:" + limit);
if (limit == 0)
return 0;
LinkedQueueNode<E> tail = newNode(s.get());
final LinkedQueueNode<E> head = tail;
for (int i = 1; i < limit; i++)
{
final LinkedQueueNode<E> temp = newNode(s.get());
// The fence here may be redundant
tail.soNext(temp);
tail = temp;
}
final LinkedQueueNode<E> oldPNode = xchgProducerNode(tail);
oldPNode.soNext(head);
return limit;
}
Just like an object factory, the oldPNode.soNext(head) can ensure correct construction.
The text was updated successfully, but these errors were encountered: