Qt 4.8
Public Functions | Static Public Functions | Public Variables | List of all members
QAbstractEventDispatcherPrivate Class Reference

#include <qabstracteventdispatcher_p.h>

Inheritance diagram for QAbstractEventDispatcherPrivate:
QObjectPrivate QObjectData QEventDispatcherGlibPrivate QEventDispatcherMacPrivate QEventDispatcherUNIXPrivate QEventDispatcherWin32Private QGuiEventDispatcherGlibPrivate QPAEventDispatcherGlibPrivate QWSEventDispatcherGlibPrivate QEventDispatcherBlackberryPrivate QEventDispatcherQPAPrivate QEventDispatcherQWSPrivate QEventDispatcherX11Private

Public Functions

void init ()
 
 QAbstractEventDispatcherPrivate ()
 
- Public Functions inherited from QObjectPrivate
void _q_reregisterTimers (void *pointer)
 
void addConnection (int signal, Connection *c)
 
void cleanConnectionLists ()
 
void connectNotify (const char *signal)
 
void deleteChildren ()
 
void disconnectNotify (const char *signal)
 
bool isSender (const QObject *receiver, const char *signal) const
 
bool isSignalConnected (uint signalIdx) const
 Returns true if the signal with index signal_index from object sender is connected. More...
 
void moveToThread_helper ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
QObjectList receiverList (const char *signal) const
 
QObjectList senderList () const
 
void setParent_helper (QObject *)
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData)
 
int signalIndex (const char *signalName) const
 Returns the signal index used in the internal connectionLists vector. More...
 
virtual ~QObjectPrivate ()
 
- Public Functions inherited from QObjectData
virtual ~QObjectData ()=0
 

Static Public Functions

static int allocateTimerId ()
 
static void releaseTimerId (int id)
 
- Static Public Functions inherited from QObjectPrivate
static void clearGuards (QObject *)
 
static QObjectPrivateget (QObject *o)
 
static void resetCurrentSender (QObject *receiver, Sender *currentSender, Sender *previousSender)
 
static SendersetCurrentSender (QObject *receiver, Sender *sender)
 
static void signalSignature (const QMetaMethod &signal, QVarLengthArray< char > *result)
 

Public Variables

QAbstractEventDispatcher::EventFilter event_filter
 
- Public Variables inherited from QObjectPrivate
union {
   QObject *   currentChildBeingDeleted
 
   QAbstractDeclarativeData *   declarativeData
 
}; 
 
quint32 connectedSignals [2]
 
QObjectConnectionListVectorconnectionLists
 
SendercurrentSender
 
QList< QPointer< QObject > > eventFilters
 
ExtraDataextraData
 
QString objectName
 
Connectionsenders
 
QAtomicPointer< QtSharedPointer::ExternalRefCountData > sharedRefcount
 
QThreadDatathreadData
 
void * unused
 
- Public Variables inherited from QObjectData
uint blockSig: 1
 
QObjectList children
 
uint hasGuards: 1
 
uint inEventHandler: 1
 
uint inThreadChangeEvent: 1
 
uint isWidget: 1
 
QMetaObjectmetaObject
 
uint ownObjectName: 1
 
QObjectparent
 
uint pendTimer: 1
 
int postedEvents
 
QObjectq_ptr
 
uint receiveChildEvents: 1
 
uint sendChildEvents: 1
 
uint unused: 22
 
uint wasDeleted: 1
 

Additional Inherited Members

- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 

Detailed Description

Definition at line 63 of file qabstracteventdispatcher_p.h.

Constructors and Destructors

◆ QAbstractEventDispatcherPrivate()

QAbstractEventDispatcherPrivate::QAbstractEventDispatcherPrivate ( )
inline

Definition at line 67 of file qabstracteventdispatcher_p.h.

68  : event_filter(0)
69  { }
QAbstractEventDispatcher::EventFilter event_filter

Functions

◆ allocateTimerId()

int QAbstractEventDispatcherPrivate::allocateTimerId ( )
static

Definition at line 175 of file qabstracteventdispatcher.cpp.

Referenced by QAbstractEventDispatcher::registerTimer().

176 {
177  int timerId, newTimerId;
178  int at, *b;
179  do {
180  timerId = nextFreeTimerId; //.loadAcquire(); // ### FIXME Proper memory ordering semantics
181 
182  // which bucket are we looking in?
183  int which = timerId & TimerIdMask;
184  int bucket = bucketOffset(which);
185  at = bucketIndex(bucket, which);
186  b = timerIds[bucket];
187 
188  if (!b) {
189  // allocate a new bucket
190  b = allocateBucket(bucket);
191  if (!timerIds[bucket].testAndSetRelease(0, b)) {
192  // another thread won the race to allocate the bucket
193  delete [] b;
194  b = timerIds[bucket];
195  }
196  }
197 
198  newTimerId = prepareNewValueWithSerialNumber(timerId, b[at]);
199  } while (!nextFreeTimerId.testAndSetRelaxed(timerId, newTimerId));
200 
201  b[at] = -timerId;
202 
203  return timerId;
204 }
static QBasicAtomicInt nextFreeTimerId
#define at(className, varName)
static QBasicAtomicPointer< int > timerIds[]
static const int TimerIdMask
bool testAndSetRelaxed(int expectedValue, int newValue)
static int bucketIndex(int bucket, int timerId)
static int * allocateBucket(int bucket)
static int prepareNewValueWithSerialNumber(int oldId, int newId)
static int bucketOffset(int timerId)

◆ init()

void QAbstractEventDispatcherPrivate::init ( )

Definition at line 151 of file qabstracteventdispatcher.cpp.

152 {
154  if (threadData->eventDispatcher != 0) {
155  qWarning("QAbstractEventDispatcher: An event dispatcher has already been created for this thread");
156  } else {
158  }
159 }
QThreadData * threadData
Definition: qobject_p.h:195
#define Q_Q(Class)
Definition: qglobal.h:2483
Q_CORE_EXPORT void qWarning(const char *,...)
QAbstractEventDispatcher * eventDispatcher
Definition: qthread_p.h:264
The QAbstractEventDispatcher class provides an interface to manage Qt&#39;s event queue.

◆ releaseTimerId()

void QAbstractEventDispatcherPrivate::releaseTimerId ( int  id)
static

Definition at line 217 of file qabstracteventdispatcher.cpp.

Referenced by QTimerInfoList::unregisterTimer(), QEventDispatcherMac::unregisterTimer(), QEventDispatcherWin32Private::unregisterTimer(), QTimerInfoList::unregisterTimers(), and QEventDispatcherMac::unregisterTimers().

218 {
219  int which = timerId & TimerIdMask;
220  int bucket = bucketOffset(which);
221  int at = bucketIndex(bucket, which);
222  int *b = timerIds[bucket];
223 
224  Q_ASSERT_X(timerId == -b[at], "QAbstractEventDispatcher::releaseTimerId",
225  "Internal error: timer ID not found");
226 
227  int freeId, newTimerId;
228  do {
229  freeId = nextFreeTimerId;//.loadAcquire(); // ### FIXME Proper memory ordering semantics
230  b[at] = freeId & TimerIdMask;
231 
232  newTimerId = prepareNewValueWithSerialNumber(freeId, timerId);
233  } while (!nextFreeTimerId.testAndSetRelease(freeId, newTimerId));
234 }
static QBasicAtomicInt nextFreeTimerId
#define at(className, varName)
static QBasicAtomicPointer< int > timerIds[]
static const int TimerIdMask
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
bool testAndSetRelease(int expectedValue, int newValue)
static int bucketIndex(int bucket, int timerId)
static int prepareNewValueWithSerialNumber(int oldId, int newId)
static int bucketOffset(int timerId)

Properties

◆ event_filter

QAbstractEventDispatcher::EventFilter QAbstractEventDispatcherPrivate::event_filter

Definition at line 71 of file qabstracteventdispatcher_p.h.


The documentation for this class was generated from the following files: