diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-12-06 16:47:27 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-12-06 16:47:27 -0600 |
commit | 78125ea2f051107b84fdc0354acdedb7885308ee (patch) | |
tree | c162d7f55467f81a01e2e669ce297acce06b3947 /src/tools | |
parent | 7aa5ac7f0e76c5b87e4ca837b75b3edd522a3372 (diff) | |
download | qt3-78125ea2f051107b84fdc0354acdedb7885308ee.tar.gz qt3-78125ea2f051107b84fdc0354acdedb7885308ee.zip |
Add real threading support, including per-thread event loops, to QThread
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/qmutex_unix.cpp | 1 | ||||
-rw-r--r-- | src/tools/qthreadinstance_p.h | 6 | ||||
-rw-r--r-- | src/tools/qucom.cpp | 24 | ||||
-rw-r--r-- | src/tools/qucom_p.h | 4 |
4 files changed, 33 insertions, 2 deletions
diff --git a/src/tools/qmutex_unix.cpp b/src/tools/qmutex_unix.cpp index 7f14e6a..fe60ac3 100644 --- a/src/tools/qmutex_unix.cpp +++ b/src/tools/qmutex_unix.cpp @@ -74,7 +74,6 @@ typedef pthread_mutex_t Q_MUTEX_T; #include <errno.h> #include <string.h> - // Private class declarations class QRealMutexPrivate : public QMutexPrivate { diff --git a/src/tools/qthreadinstance_p.h b/src/tools/qthreadinstance_p.h index 72611b1..7580b25 100644 --- a/src/tools/qthreadinstance_p.h +++ b/src/tools/qthreadinstance_p.h @@ -62,8 +62,12 @@ #include <pthread.h> #endif +class QThread; +class QEventLoop; + class QThreadInstance { public: + static void setCurrentThread(QThread *thread); static QThreadInstance *current(); void init(unsigned int stackSize); @@ -95,6 +99,8 @@ public: static unsigned int __stdcall start( void * ); static void finish( QThreadInstance * ); #endif // Q_OS_WIN32 + + QEventLoop* eventLoop; }; #endif // QT_THREAD_SUPPORT diff --git a/src/tools/qucom.cpp b/src/tools/qucom.cpp index f210318..c48e166 100644 --- a/src/tools/qucom.cpp +++ b/src/tools/qucom.cpp @@ -39,6 +39,9 @@ **********************************************************************/ #include "qucom_p.h" +#include "qucomextra_p.h" + +#include "qvariant.h" // Standard types @@ -545,3 +548,24 @@ void QUType_QString::clear( QUObject *o ) delete (QString*)o->payload.ptr; o->payload.ptr = 0; } + +QUObject* QUObject::deepCopy(QUObject* newLocation) { + QUObject* ret; + if (newLocation) { + ret = new(newLocation) QUObject(*this); + } + else { + ret = new QUObject(*this); + } + // Any type that has a clear() method must be copied here! + if (*(type->uuid()) == TID_QUType_charstar) { + static_QUType_charstar.set( ret, (const char *)static_QUType_charstar.get(this), true ); + } + if (*(type->uuid()) == TID_QUType_QString) { + static_QUType_QString.set( ret, (QString)static_QUType_QString.get(this) ); + } + if (*(type->uuid()) == TID_QUType_QVariant) { + static_QUType_QVariant.set( ret, (QVariant)static_QUType_QVariant.get(this) ); + } + return ret; +} diff --git a/src/tools/qucom_p.h b/src/tools/qucom_p.h index 6410ceb..3ade5d4 100644 --- a/src/tools/qucom_p.h +++ b/src/tools/qucom_p.h @@ -127,7 +127,7 @@ extern Q_EXPORT QUType_Null static_QUType_Null; struct Q_EXPORT QUObject { public: // scary MSVC bug makes this necessary - QUObject() : type( &static_QUType_Null ) {} + QUObject() : type( &static_QUType_Null ), isLastObject(false) {} ~QUObject() { type->clear( this ); } QUType *type; @@ -184,6 +184,8 @@ public: // scary MSVC bug makes this necessary } payload; + QUObject* deepCopy(QUObject*); + bool isLastObject; }; |