Provides a dispatch source. More...
#include <QtDispatch/qdispatchsource.h>
Public Slots | |
void | resume () |
Suspends the source, i.e. | |
void | suspend () |
Public Member Functions | |
QDispatchSource (QDispatchSourceType *) | |
Creates a new source waiting for the given type. | |
~QDispatchSource () | |
void | setHandler (QRunnable *) |
Sets the given runnable as handler that will be executed each time the source has become ready. | |
void | setHandler (dispatch_block_t b) |
Sets the given block as handler that will be executed each time the source has become ready. | |
QDispatchQueue | targetQueue () const |
void | setTargetQueue (const QDispatchQueue &) |
Sets the target, i.e. | |
Static Public Member Functions | |
template<typename T > | |
static T * | data () |
Provides a dispatch source.
A dispatch source will wait for a specific ressource to become available or some other component to finish a current job and dispatch a specified handler upon completion.
The currently supported QDispatchSourceTypes are:
You can easily add your own by subclassing QDispatchSourceType
Please note that this class is quite rudimentary currently. When needing sophisticated sources for dispatching, it is recommended to use xdispatch::source instead.
Definition at line 222 of file qdispatchsource.h.
Creates a new source waiting for the given type.
The passed type will be deleted as soon as the source is deleted
static T* QDispatchSource::data | ( | ) | [inline, static] |
Pass the type of the data to retrieve as template parameter. A pointer of the given type will be returned, or NULL if the available data is not of the requested type.
Call this to obtain data from within a handler while executing. Calling this method from somewhere else than an executing handler is undefined.
Definition at line 291 of file qdispatchsource.h.
void QDispatchSource::resume | ( | ) | [slot] |
Suspends the source, i.e.
it will stop dispatching the handler. Calls to resume() and suspend() should be balanced.
void QDispatchSource::setHandler | ( | QRunnable * | ) |
Sets the given runnable as handler that will be executed each time the source has become ready.
void QDispatchSource::setHandler | ( | dispatch_block_t | b | ) | [inline] |
Sets the given block as handler that will be executed each time the source has become ready.
Definition at line 249 of file qdispatchsource.h.
void QDispatchSource::setTargetQueue | ( | const QDispatchQueue & | ) |
Sets the target, i.e.
the queue the handler will be dispatched on. Defaults to QDispatch::globalQueue().
void QDispatchSource::suspend | ( | ) | [slot] |
QDispatchQueue QDispatchSource::targetQueue | ( | ) | const |