Top Description Fields Constructors Methods
com.jogamp.opencl.util

public Class MultiQueueBarrier

extends Object
Class Inheritance
Imports
com.jogamp.opencl.CLCommandQueue, .CLEventList, java.util.Collections, .HashSet, .Set, java.util.concurrent.CountDownLatch, .TimeUnit

An utility for synchronizing multiple concurrent CLCommandQueues. This Barrier can be reused after it has been broken.
Author
Michael Bien

Field Summary

Modifier and TypeField and Description
private final int
private CountDownLatch
private final Set<CLCommandQueue>

Constructor Summary

AccessConstructor and Description
public
MultiQueueBarrier(final int queueCount)

Creates a new MultiQueueBarrier with the given queueCount.

public
MultiQueueBarrier(final CLCommandQueue... allowedQueues)

Creates a new MultiQueueBarrier for the given queues.

Method Summary

Modifier and TypeMethod and Description
public MultiQueueBarrier
await()

Blocks until all Threads which called waitFor continue execution.

public boolean
await(final long
the maximum time to wait
timeout
,
final TimeUnit
the time unit of the timeout argument
unit
)

private void
public long
getCount()

Returns the current number of events which must occure before this barrier unblocks the waiting threads.

private void
public void
resetBarrier()

Resets this barrier and unblocks all waiting threads.

public MultiQueueBarrier
waitFor(final CLCommandQueue queue)

Blocks the current Thread until all commands on the CLCommandQueue finished excecution.

public MultiQueueBarrier
waitFor(final CLCommandQueue queue, final CLEventList events)

Blocks the current Thread until the given events on the CLCommandQueue occurred.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

countback to summary
private final int count
latchback to summary
private CountDownLatch latch
queuesback to summary
private final Set<CLCommandQueue> queues

Constructor Detail

MultiQueueBarrierback to summary
public MultiQueueBarrier(final int queueCount)

Creates a new MultiQueueBarrier with the given queueCount. It is recommented to use MultiQueueBarrier(CLCommandQueue... allowedQueues) if possible which restricts the set of allowed queues for the barrier.

MultiQueueBarrierback to summary
public MultiQueueBarrier(final CLCommandQueue... allowedQueues)

Creates a new MultiQueueBarrier for the given queues.

Method Detail

awaitback to summary
public MultiQueueBarrier await() throws InterruptedException

Blocks until all Threads which called waitFor continue execution. This method blocks only once, all subsequent calls are ignored.

awaitback to summary
public boolean await(final long timeout, final TimeUnit unit) throws InterruptedException
Parameters
timeout:long

the maximum time to wait

unit:TimeUnit

the time unit of the timeout argument

See Also
await()
checkQueueback to summary
private void checkQueue(final CLCommandQueue queue) throws IllegalArgumentException
getCountback to summary
public long getCount()

Returns the current number of events which must occure before this barrier unblocks the waiting threads. This method is typically used for debugging and testing purposes.

rebuildBarrierIfBrokenback to summary
private void rebuildBarrierIfBroken()
resetBarrierback to summary
public void resetBarrier()

Resets this barrier and unblocks all waiting threads.

waitForback to summary
public MultiQueueBarrier waitFor(final CLCommandQueue queue)

Blocks the current Thread until all commands on the CLCommandQueue finished excecution. This method may be invoked concurrently without synchronization on the MultiQueueBarrier object as long each Thread passes a distinct CLCommandQueue as parameter to this method.

waitForback to summary
public MultiQueueBarrier waitFor(final CLCommandQueue queue, final CLEventList events)

Blocks the current Thread until the given events on the CLCommandQueue occurred. This method may be invoked concurrently without synchronization on the MultiQueueBarrier object as long each Thread passes a distinct CLCommandQueue as parameter to this method.