XDispatch 0.7.1
Public Slots | Public Member Functions | Static Public Member Functions
QDispatchSource Class Reference

Provides a dispatch source. More...

#include <QtDispatch/qdispatchsource.h>

List of all members.

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 ()

Detailed Description

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.


Constructor & Destructor Documentation

Creates a new source waiting for the given type.

The passed type will be deleted as soon as the source is deleted


Member Function Documentation

template<typename T >
static T* QDispatchSource::data ( ) [inline, static]
Returns:
the data associated to the current QDispatchSourceType. See the individual type documentations for details on the data available.

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.

Remarks:
Make sure to carefully read the docs of the used sourcetype to know wether it is you own duty to release the data or not.

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.

Remarks:
Please note that objects passed to QDispatchSourceType::ready() might not geht released while the source is suspended
void QDispatchSource::setHandler ( QRunnable *  )

Sets the given runnable as handler that will be executed each time the source has become ready.

See also:
data() and the source type's documentation on how to obtain information about the reason the source has become ready

Sets the given block as handler that will be executed each time the source has become ready.

See also:
data() and the source type's documentation on how to obtain information about the reason the source has become ready

Definition at line 249 of file qdispatchsource.h.

Sets the target, i.e.

the queue the handler will be dispatched on. Defaults to QDispatch::globalQueue().

void QDispatchSource::suspend ( ) [slot]
Returns:
The queue the handler will be dispatched on. Defaults to QDispatch::globalQueue();

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Sun Oct 28 2012 22:12:47 for XDispatch by Doxygen 1.7.6.1
© 2010-2012 MLBA (about | privacy) All Rights reserved.