|
|
@ -52,10 +52,6 @@ typedef pthread_mutex_t Q_MUTEX_T;
|
|
|
|
#include <errno.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <sched.h>
|
|
|
|
#include <sched.h>
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(QT_USE_GLIBMAINLOOP)
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#endif // QT_USE_GLIBMAINLOOP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static TQMutexPool *qt_thread_mutexpool = 0;
|
|
|
|
static TQMutexPool *qt_thread_mutexpool = 0;
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(Q_C_CALLBACKS)
|
|
|
|
#if defined(Q_C_CALLBACKS)
|
|
|
@ -126,12 +122,6 @@ void *TQThreadInstance::start( void *_arg )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
void **arg = (void **) _arg;
|
|
|
|
void **arg = (void **) _arg;
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(QT_USE_GLIBMAINLOOP)
|
|
|
|
|
|
|
|
// This is the first time we have access to the native pthread ID of this newly created thread
|
|
|
|
|
|
|
|
((TQThreadInstance*)arg[1])->thread_id = pthread_self();
|
|
|
|
|
|
|
|
pthread_detach(pthread_self());
|
|
|
|
|
|
|
|
#endif // QT_USE_GLIBMAINLOOP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef QT_DEBUG
|
|
|
|
#ifdef QT_DEBUG
|
|
|
|
tqDebug("TQThreadInstance::start: Setting thread storage to %p\n", (TQThread *) arg[0]);
|
|
|
|
tqDebug("TQThreadInstance::start: Setting thread storage to %p\n", (TQThread *) arg[0]);
|
|
|
|
#endif // QT_DEBUG
|
|
|
|
#endif // QT_DEBUG
|
|
|
@ -417,26 +407,6 @@ void TQThread::start(Priority priority)
|
|
|
|
|
|
|
|
|
|
|
|
d->args[0] = this;
|
|
|
|
d->args[0] = this;
|
|
|
|
d->args[1] = d;
|
|
|
|
d->args[1] = d;
|
|
|
|
#if defined(QT_USE_GLIBMAINLOOP)
|
|
|
|
|
|
|
|
// The correct thread_id is set in TQThreadInstance::start using the value of d->args[1]
|
|
|
|
|
|
|
|
d->thread_id = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// glib versions < 2.32.0 requires threading system initialization call
|
|
|
|
|
|
|
|
#if GLIB_CHECK_VERSION(2, 32, 0)
|
|
|
|
|
|
|
|
GThread* glib_thread_handle = g_thread_new( NULL, (GThreadFunc)TQThreadInstance::start, d->args );
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
if( !g_thread_get_initialized() );
|
|
|
|
|
|
|
|
g_thread_init(NULL);
|
|
|
|
|
|
|
|
GThread* glib_thread_handle = g_thread_create((GThreadFunc)TQThreadInstance::start, d->args, false, NULL);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (glib_thread_handle) {
|
|
|
|
|
|
|
|
ret = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
ret = -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#else // QT_USE_GLIBMAINLOOP
|
|
|
|
|
|
|
|
ret = pthread_create( &d->thread_id, &attr, (TQtThreadCallback)TQThreadInstance::start, d->args );
|
|
|
|
ret = pthread_create( &d->thread_id, &attr, (TQtThreadCallback)TQThreadInstance::start, d->args );
|
|
|
|
#if defined (Q_OS_HPUX)
|
|
|
|
#if defined (Q_OS_HPUX)
|
|
|
|
if (ret == EPERM) {
|
|
|
|
if (ret == EPERM) {
|
|
|
@ -445,7 +415,6 @@ void TQThread::start(Priority priority)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
pthread_attr_destroy( &attr );
|
|
|
|
pthread_attr_destroy( &attr );
|
|
|
|
#endif // QT_USE_GLIBMAINLOOP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( ret ) {
|
|
|
|
if ( ret ) {
|
|
|
|
#ifdef QT_CHECK_STATE
|
|
|
|
#ifdef QT_CHECK_STATE
|
|
|
|