Skip to content
Snippets Groups Projects
Commit 9fc9aa50 authored by Max Bt's avatar Max Bt
Browse files

NWS Pipe added.

parent 941be7e5
No related branches found
No related tags found
No related merge requests found
......@@ -60,7 +60,7 @@ public final class WorkStealingPipe<T> extends AbstractSynchedPipe<T> implements
Object obj = this.queue.poll();
if (obj != null) {
return obj;
} else {
} else if (haulSize > 0) {
int index;
WorkStealingPipe<T> victim;
if (busyCheck) {
......@@ -96,6 +96,9 @@ public final class WorkStealingPipe<T> extends AbstractSynchedPipe<T> implements
}
}
return this.queue.poll();
} else {
// haulSize is 0 and we're not permitted to steal:
return null;
}
}
......
......@@ -82,4 +82,12 @@ public class WorkStealingPipeFactory<T> {
return create(source, target, 0, 1, true);
}
/**
* Create a pipe utilizing no work stealing. This pipe is only able to become a victim and no theft will be attempted.
* Mimicks a {@link BoundedSynchedPipe} in behaviour.
*/
public WorkStealingPipe<T> createNWSPipe(final OutputPort<? extends T> source, final InputPort<T> target) {
return create(source, target, 0, 0, false);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment