|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QFutureSynchronizer
public class QFutureSynchronizer
The QFutureSynchronizer class is a convenience class that simplifies QFuture
synchronization. QFutureSynchronizer is a template class that simplifies synchronization of one or more QFuture
objects. Futures are added using the addFuture()
or setFuture()
functions. The futures()
function returns a list of futures. Use clearFutures()
to remove all futures from the QFutureSynchronizer.
The waitForFinished()
function waits for all futures to finish. The destructor of QFutureSynchronizer calls waitForFinished()
, providing an easy way to ensure that all futures have finished before returning from a function:
public final void someFunction() { QFutureSynchronizerVoid synchronizer = new QFutureSynchronizerVoid(); ... synchronizer.addFuture(QtConcurrent.runVoidMethod(this, anotherMethod, arg1, arg2)); synchronizer.addFuture(QtConcurrent.map(list, mapFunctor)); return; // QFutureSynchronizer waits for all futures to finish }The behavior of
waitForFinished()
can be changed using the setCancelOnWait()
function. Calling setCancelOnWait(true) will cause waitForFinished()
to cancel all futures before waiting for them to finish. You can query the status of the cancel-on-wait feature using the cancelOnWait()
function. QFuture
, QFutureWatcher
, and Qt Concurrent.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
---|
QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9 |
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal |
Field Summary |
---|
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
currentSender |
Constructor Summary | |
---|---|
QFutureSynchronizer()
Constructs a QFutureSynchronizer. |
|
QFutureSynchronizer(QFuture future)
Constructs a QFutureSynchronizer and begins watching future by calling addFuture() . |
Method Summary | |
---|---|
void |
addFuture(QFuture future)
Adds future to the list of managed futures. |
boolean |
cancelOnWait()
Returns true if the cancel-on-wait feature is enabled; otherwise returns false. |
void |
clearFutures()
Removes all managed futures from this QFutureSynchronizer. |
java.util.List |
futures()
Returns a list of all managed futures. |
void |
setCancelOnWait(boolean enabled)
Enables or disables the cancel-on-wait feature based on the enabled argument. |
void |
setFuture(QFuture future)
Sets future to be the only future managed by this QFutureSynchronizer. |
void |
waitForFinished()
Waits for all futures to finish. |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
__qt_signalInitialization |
Methods inherited from class java.lang.Object |
---|
clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Constructor Detail |
---|
public QFutureSynchronizer()
public QFutureSynchronizer(QFuture future)
addFuture()
. addFuture()
.
Method Detail |
---|
public final void addFuture(QFuture future)
futures()
.
public final boolean cancelOnWait()
waitForFinished()
function will cancel all futures before waiting for them to finish. setCancelOnWait()
, and waitForFinished()
.
public final void clearFutures()
addFuture()
, and setFuture()
.
public final void setCancelOnWait(boolean enabled)
waitForFinished()
function will cancel all futures before waiting for them to finish. cancelOnWait()
, and waitForFinished()
.
public final void setFuture(QFuture future)
waitForFinished()
, then clearFutures()
, and finally passes future to addFuture()
. addFuture()
, waitForFinished()
, and clearFutures()
.
public final void waitForFinished()
cancelOnWait()
returns true, each future is canceled before waiting for them to finish. cancelOnWait()
, and setCancelOnWait()
.
public final java.util.List futures()
addFuture()
, and setFuture()
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |