summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorDarrell Anderson <humanreadable@yahoo.com>2012-12-19 14:03:14 -0600
committerDarrell Anderson <humanreadable@yahoo.com>2012-12-19 14:03:14 -0600
commitf8224f3a623495e4e1dbf852554d7601a6b7c4c4 (patch)
treed5583114ba48669960c9f7d68927687ea652a0b8 /src/tools
parent25240579092616b09d28705ac84e13e49b744707 (diff)
parente8cbbedf46da493d2c206444a7e18e5777402905 (diff)
downloadtqt3-f8224f3a623495e4e1dbf852554d7601a6b7c4c4.tar.gz
tqt3-f8224f3a623495e4e1dbf852554d7601a6b7c4c4.zip
Merge branch 'master' of http://scm.trinitydesktop.org/scm/git/tqt3
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/ntqmutex.h3
-rw-r--r--src/tools/qmutex_p.h1
-rw-r--r--src/tools/qmutex_unix.cpp29
-rw-r--r--src/tools/qthreadinstance_p.h6
-rw-r--r--src/tools/qucom.cpp24
-rw-r--r--src/tools/qucom_p.h4
6 files changed, 65 insertions, 2 deletions
diff --git a/src/tools/ntqmutex.h b/src/tools/ntqmutex.h
index 2a9afb1d2..7b73514da 100644
--- a/src/tools/ntqmutex.h
+++ b/src/tools/ntqmutex.h
@@ -74,6 +74,9 @@ private:
TQMutex( const TQMutex & );
TQMutex &operator=( const TQMutex & );
#endif
+
+public:
+ int level();
};
class Q_EXPORT TQMutexLocker
diff --git a/src/tools/qmutex_p.h b/src/tools/qmutex_p.h
index 7650cee8b..3e9de8e5c 100644
--- a/src/tools/qmutex_p.h
+++ b/src/tools/qmutex_p.h
@@ -67,6 +67,7 @@ public:
virtual bool locked() = 0;
virtual bool trylock() = 0;
virtual int type() const = 0;
+ virtual int level() = 0;
};
diff --git a/src/tools/qmutex_unix.cpp b/src/tools/qmutex_unix.cpp
index b69661ad1..3fff83366 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 TQRealMutexPrivate : public TQMutexPrivate {
@@ -86,6 +85,7 @@ public:
bool locked();
bool trylock();
int type() const;
+ int level();
bool recursive;
};
@@ -102,6 +102,7 @@ public:
bool locked();
bool trylock();
int type() const;
+ int level();
int count;
unsigned long owner;
@@ -197,6 +198,11 @@ int TQRealMutexPrivate::type() const
return recursive ? Q_MUTEX_RECURSIVE : Q_MUTEX_NORMAL;
}
+int TQRealMutexPrivate::level()
+{
+ return locked();
+}
+
#ifndef Q_RECURSIVE_MUTEX_TYPE
TQRecursiveMutexPrivate::TQRecursiveMutexPrivate()
@@ -330,6 +336,11 @@ int TQRecursiveMutexPrivate::type() const
return Q_MUTEX_RECURSIVE;
}
+int TQRecursiveMutexPrivate::level()
+{
+ return count;
+}
+
#endif // !Q_RECURSIVE_MUTEX_TYPE
@@ -512,6 +523,22 @@ bool TQMutex::tryLock()
}
/*!
+ Returns the current lock level of the mutex.
+ 0 means the mutex is unlocked
+ This method should only be called when the mutex has already been locked
+ by lock(), otherwise the lock level could change before the next line
+ of code is executed.
+
+ WARNING: Non-recursive mutexes will never exceed a lock level of 1!
+
+ \sa lock(), unlock(), locked()
+*/
+int TQMutex::level()
+{
+ return d->level();
+}
+
+/*!
\class TQMutexLocker ntqmutex.h
\brief The TQMutexLocker class simplifies locking and unlocking TQMutexes.
diff --git a/src/tools/qthreadinstance_p.h b/src/tools/qthreadinstance_p.h
index 62c569c42..98ef3d95b 100644
--- a/src/tools/qthreadinstance_p.h
+++ b/src/tools/qthreadinstance_p.h
@@ -62,8 +62,12 @@
#include <pthread.h>
#endif
+class TQThread;
+class TQEventLoop;
+
class TQThreadInstance {
public:
+ static void setCurrentThread(TQThread *thread);
static TQThreadInstance *current();
void init(unsigned int stackSize);
@@ -95,6 +99,8 @@ public:
static unsigned int __stdcall start( void * );
static void finish( TQThreadInstance * );
#endif // Q_OS_WIN32
+
+ TQEventLoop* eventLoop;
};
#endif // QT_THREAD_SUPPORT
diff --git a/src/tools/qucom.cpp b/src/tools/qucom.cpp
index 6035d6622..d3b26c3f9 100644
--- a/src/tools/qucom.cpp
+++ b/src/tools/qucom.cpp
@@ -39,6 +39,9 @@
**********************************************************************/
#include "qucom_p.h"
+#include "qucomextra_p.h"
+
+#include "ntqvariant.h"
// Standard types
@@ -545,3 +548,24 @@ void TQUType_TQString::clear( TQUObject *o )
delete (TQString*)o->payload.ptr;
o->payload.ptr = 0;
}
+
+TQUObject* TQUObject::deepCopy(TQUObject* newLocation) {
+ TQUObject* ret;
+ if (newLocation) {
+ ret = new(newLocation) TQUObject(*this);
+ }
+ else {
+ ret = new TQUObject(*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_TQString) {
+ static_QUType_TQString.set( ret, (TQString)static_QUType_TQString.get(this) );
+ }
+ if (*(type->uuid()) == TID_QUType_TQVariant) {
+ static_QUType_TQVariant.set( ret, (TQVariant)static_QUType_TQVariant.get(this) );
+ }
+ return ret;
+}
diff --git a/src/tools/qucom_p.h b/src/tools/qucom_p.h
index 0814e18d7..f4f7ea81b 100644
--- a/src/tools/qucom_p.h
+++ b/src/tools/qucom_p.h
@@ -127,7 +127,7 @@ extern Q_EXPORT TQUType_Null static_QUType_Null;
struct Q_EXPORT TQUObject
{
public: // scary MSVC bug makes this necessary
- TQUObject() : type( &static_QUType_Null ) {}
+ TQUObject() : type( &static_QUType_Null ), isLastObject(false) {}
~TQUObject() { type->clear( this ); }
TQUType *type;
@@ -184,6 +184,8 @@ public: // scary MSVC bug makes this necessary
} payload;
+ TQUObject* deepCopy(TQUObject*);
+ bool isLastObject;
};