46 #include <private/qthread_p.h> 47 #include <private/qcoreapplication_p.h> 58 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
59 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32
103 delete [] static_cast<int *>(timerIds[i]);
116 template<
bool>
struct QStaticAssertType;
117 template<>
struct QStaticAssertType<true> {
enum { Value = 1 }; };
119 #define q_static_assert(expr) (void)QStaticAssertType<expr>::Value 131 qFatal(
"QAbstractEventDispatcher: INTERNAL ERROR, timer ID %d is too large", timerId);
145 int *b =
new int[size];
146 for (
int i = 0; i != size; ++i)
147 b[i] = offset + i + 1;
154 if (threadData->eventDispatcher != 0) {
155 qWarning(
"QAbstractEventDispatcher: An event dispatcher has already been created for this thread");
157 threadData->eventDispatcher = q;
177 int timerId, newTimerId;
191 if (!
timerIds[bucket].testAndSetRelease(0, b)) {
224 Q_ASSERT_X(timerId == -b[at],
"QAbstractEventDispatcher::releaseTimerId",
225 "Internal error: timer ID not found");
227 int freeId, newTimerId;
563 if (
d->event_filter) {
567 return d->event_filter(message);
virtual void startingUp()
bool filterEvent(void *message)
Sends message through the event filter that was set by setEventFilter().
#define QT_END_NAMESPACE
This macro expands to.
static QBasicAtomicInt nextFreeTimerId
static QAbstractEventDispatcher * instance(QThread *thread=0)
Returns a pointer to the event dispatcher object for the specified thread.
#define at(className, varName)
static QBasicAtomicPointer< int > timerIds[]
static const int TimerIdMask
#define Q_DESTRUCTOR_FUNCTION(AFUNC)
The QObject class is the base class of all Qt objects.
#define Q_BASIC_ATOMIC_INITIALIZER(a)
static const int TimerSerialMask
#define q_static_assert(expr)
static QThreadData * get2(QThread *thread)
bool testAndSetRelaxed(int expectedValue, int newValue)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Q_CORE_EXPORT void qWarning(const char *,...)
static const char * data(const QByteArray &arr)
~QAbstractEventDispatcher()
Destroys the event dispatcher.
int registerTimer(int interval, QObject *object)
Registers a timer with the specified interval for the given object.
static const int TimerSerialCounter
virtual void closingDown()
bool(* EventFilter)(void *message)
Typedef for a function with the signature.
Q_CORE_EXPORT void qFatal(const char *,...)
#define Q_ASSERT_X(cond, where, what)
bool testAndSetRelease(int expectedValue, int newValue)
static void timerIdsDestructorFunction()
static const int BucketOffset[]
EventFilter setEventFilter(EventFilter filter)
Replaces the event filter function for this QAbstractEventDispatcher with filter and returns the repl...
QObject * parent() const
Returns a pointer to the parent object.
QAbstractEventDispatcher(QObject *parent=0)
Constructs a new event dispatcher with the given parent.
static int bucketIndex(int bucket, int timerId)
QFuture< void > filter(Sequence &sequence, FilterFunction filterFunction)
static void releaseTimerId(int id)
static QThreadData * current()
static const int MaxTimerId
static int * allocateBucket(int bucket)
static const int BucketSize[]
QThread * thread() const
Returns the thread in which the object lives.
The QThread class provides a platform-independent way to manage threads.
static int prepareNewValueWithSerialNumber(int oldId, int newId)
static int allocateTimerId()
QAbstractEventDispatcher * eventDispatcher
The QAbstractEventDispatcher class provides an interface to manage Qt's event queue.
static int bucketOffset(int timerId)