Provides a dispatch source. More...
Public Slots | |
void | resume () |
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) |
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
QDispatchSource::QDispatchSource | ( | QDispatchSourceType * | ) |
Creates a new source waiting for the given type.
The passed type will be deleted as soon as the source is deleted
QDispatchSource::~QDispatchSource | ( | ) |
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.
void QDispatchSource::resume | ( | ) | [slot] |
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 | ) |
Sets the given block as handler that will be executed each time the source has become ready.
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 |