Automated update from Qt3

pull/1/head
Timothy Pearson 11 years ago
parent d83cf65002
commit 8d210f61fc

@ -113,9 +113,12 @@ public:
CleanupMergeObjects
};
CleanupType cleanupType();
CleanupType cleanupType() const;
void setCleanupType(CleanupType);
bool threadPostedEventsDisabled() const;
void setThreadPostedEventsDisabled(bool);
protected:
virtual void run() = 0;

@ -688,7 +688,7 @@ int TQEventLoop::activateTimers()
TQTimerEvent e( t->id );
#if defined(QT_THREAD_SUPPORT)
// Be careful...the current thread may not be the target object's thread!
if ((!t->obj) || (t->obj && (t->obj->contextThreadObject() == TQThread::currentThreadObject()))) {
if ((!t->obj) || (TQThread::currentThreadObject()->threadPostedEventsDisabled()) || (t->obj && (t->obj->contextThreadObject() == TQThread::currentThreadObject()))) {
TQApplication::sendEvent( t->obj, &e ); // send event
}
else {
@ -731,7 +731,7 @@ int TQEventLoop::activateSocketNotifiers()
sn->pending = FALSE;
#if defined(QT_THREAD_SUPPORT)
// Be careful...the current thread may not be the target object's thread!
if ((!sn->obj) || (sn->obj && (sn->obj->contextThreadObject() == TQThread::currentThreadObject()))) {
if ((!sn->obj) || (TQThread::currentThreadObject()->threadPostedEventsDisabled()) || (sn->obj && (sn->obj->contextThreadObject() == TQThread::currentThreadObject()))) {
TQApplication::sendEvent( sn->obj, &event ); // send event
}
else {

@ -2727,7 +2727,7 @@ void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o )
sol->currentSender = this;
}
if ( c->memberType() == TQSIGNAL_CODE ) {
if ((d->disableThreadPostedEvents) || (object->d->ownThread == currentThread)) {
if ((d->disableThreadPostedEvents) || (object->d->disableThreadPostedEvents) || (currentThread->threadPostedEventsDisabled()) || (object->d->ownThread == currentThread)) {
#ifdef QT_THREAD_SUPPORT
sol->listMutex->unlock();
#endif // QT_THREAD_SUPPORT
@ -2738,12 +2738,15 @@ void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o )
}
else {
if (object->d->ownThread && !object->d->ownThread->finished()) {
#ifdef QT_DEBUG
tqDebug("TQObject::activate_signal: Emitting cross-thread signal from object %p (member %d receiver %p) (1)\n\r", this, c->member(), object);
#endif // QT_DEBUG
TQApplication::postEvent(object, new TQMetaCallEvent(c->member(), this, deepCopyTQUObjectArray(o), TQMetaCallEvent::MetaCallEmit));
}
}
}
else {
if ((d->disableThreadPostedEvents) || (object->d->ownThread == currentThread)) {
if ((d->disableThreadPostedEvents) || (object->d->disableThreadPostedEvents) || (currentThread->threadPostedEventsDisabled()) || (object->d->ownThread == currentThread)) {
#ifdef QT_THREAD_SUPPORT
sol->listMutex->unlock();
#endif // QT_THREAD_SUPPORT
@ -2754,6 +2757,9 @@ void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o )
}
else {
if (object->d->ownThread && !object->d->ownThread->finished()) {
#ifdef QT_DEBUG
tqDebug("TQObject::activate_signal: Invoking cross-thread method from object %p (member %d receiver %p) (1)\n\r", this, c->member(), object);
#endif // QT_DEBUG
TQApplication::postEvent(object, new TQMetaCallEvent(c->member(), this, deepCopyTQUObjectArray(o), TQMetaCallEvent::MetaCallInvoke));
}
}
@ -2788,7 +2794,7 @@ void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o )
sol->currentSender = this;
}
if ( c->memberType() == TQSIGNAL_CODE ) {
if ((d->disableThreadPostedEvents) || (object->d->ownThread == currentThread)) {
if ((d->disableThreadPostedEvents) || (object->d->disableThreadPostedEvents) || (currentThread->threadPostedEventsDisabled()) || (object->d->ownThread == currentThread)) {
#ifdef QT_THREAD_SUPPORT
sol->listMutex->unlock();
#endif // QT_THREAD_SUPPORT
@ -2799,12 +2805,15 @@ void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o )
}
else {
if (object->d->ownThread && !object->d->ownThread->finished()) {
#ifdef QT_DEBUG
tqDebug("TQObject::activate_signal: Emitting cross-thread signal from object %p (member %d receiver %p) (2)\n\r", this, c->member(), object);
#endif // QT_DEBUG
TQApplication::postEvent(object, new TQMetaCallEvent(c->member(), this, deepCopyTQUObjectArray(o), TQMetaCallEvent::MetaCallEmit));
}
}
}
else {
if ((d->disableThreadPostedEvents) || (object->d->ownThread == currentThread)) {
if ((d->disableThreadPostedEvents) || (object->d->disableThreadPostedEvents) || (currentThread->threadPostedEventsDisabled()) || (object->d->ownThread == currentThread)) {
#ifdef QT_THREAD_SUPPORT
sol->listMutex->unlock();
#endif // QT_THREAD_SUPPORT
@ -2815,6 +2824,9 @@ void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o )
}
else {
if (object->d->ownThread && !object->d->ownThread->finished()) {
#ifdef QT_DEBUG
tqDebug("TQObject::activate_signal: Invoking cross-thread method from object %p (member %d receiver %p) (2)\n\r", this, c->member(), object);
#endif // QT_DEBUG
TQApplication::postEvent(object, new TQMetaCallEvent(c->member(), this, deepCopyTQUObjectArray(o), TQMetaCallEvent::MetaCallInvoke));
}
}

@ -223,6 +223,29 @@ bool TQThread::running() const
return d->running;
}
/*!
Changes the way cross thread signals are handled
If disable is FALSE, signals emitted from this thread will be
posted to any other connected threads' event loops (default).
If disable is TRUE, calls to emit from this thread
will immediately execute slots in another thread.
This mode of operation is inherently unsafe and is provided
solely to support thread management by a third party application.
*/
void TQThread::setThreadPostedEventsDisabled(bool disable)
{
d->disableThreadPostedEvents = disable;
}
/*!
Returns TRUE if thread posted events are disabled, FALSE if not
*/
bool TQThread::threadPostedEventsDisabled() const
{
return d->disableThreadPostedEvents;
}
/*!
\fn void TQThread::run()

@ -105,6 +105,7 @@ void TQThreadInstance::init(unsigned int stackSize)
finished = FALSE;
running = FALSE;
orphan = FALSE;
disableThreadPostedEvents = FALSE;
pthread_cond_init(&thread_done, NULL);
thread_id = 0;
@ -130,6 +131,9 @@ void *TQThreadInstance::start( void *_arg )
((TQThreadInstance*)arg[1])->thread_id = pthread_self();
#endif // QT_USE_GLIBMAINLOOP
#ifdef QT_DEBUG
tqDebug("TQThreadInstance::start: Setting thread storage to %p\n\r", (TQThread *) arg[0]);
#endif // QT_DEBUG
setCurrentThread( (TQThread *) arg[0] );
pthread_cleanup_push( TQThreadInstance::finish, arg[1] );
@ -152,6 +156,8 @@ void TQThreadInstance::finish( void * )
return;
}
tqDebug("TQThreadInstance::finish: In TQThreadInstance::finish for thread %p\n\r", (TQThread*)d->args[0]);
TQApplication::threadTerminationHandler((TQThread*)d->args[0]);
TQMutexLocker locker( d->mutex() );
@ -510,7 +516,7 @@ bool TQThread::wait( unsigned long time )
\sa CleanupType
*/
TQThread::CleanupType TQThread::cleanupType() {
TQThread::CleanupType TQThread::cleanupType() const {
return (TQThread::CleanupType)d->cleanupType;
}

@ -102,6 +102,7 @@ public:
TQEventLoop* eventLoop;
int cleanupType;
bool disableThreadPostedEvents : 1;
};
#endif // QT_THREAD_SUPPORT

@ -57,11 +57,11 @@ void MainObject::buttonClicked()
eventLoop->exit(0);
}
#define SET_UP_WORKER(x, y, z) \
WorkerObject x; \
x.threadFriendlyName = y; \
x.moveToThread(&z); \
TQObject::connect(&x, SIGNAL(displayMessage(TQString,TQString)), &mainobject, SLOT(emitMessage(TQString,TQString))); \
#define SET_UP_WORKER(x, y, z) \
WorkerObject x; \
x.threadFriendlyName = y; \
x.moveToThread(&z); \
TQObject::connect(&x, SIGNAL(displayMessage(TQString,TQString)), &mainobject, SLOT(emitMessage(TQString,TQString))); \
TQTimer::singleShot(0, &x, SLOT(run()));
int main( int argc, char **argv )

Loading…
Cancel
Save