#include "qthread.h"
#include "qplatformdefs.h"
#include <private/qcoreapplication_p.h>
#include "../kernel/qeventdispatcher_glib_p.h"
#include <private/qeventdispatcher_unix_p.h>
#include "qthreadstorage.h"
#include "qthread_p.h"
#include "qdebug.h"
#include <sched.h>
#include <errno.h>
#include <CoreServices/CoreServices.h>
#include <sys/prctl.h>
Go to the source code of this file.
◆ QT_HAS_THREAD_PRIORITY_SCHEDULING
#define QT_HAS_THREAD_PRIORITY_SCHEDULING |
◆ SCHED_IDLE
◆ QtThreadCallback
typedef void*(* QtThreadCallback) (void *) |
◆ anonymous enum
◆ calculateUnixPriority()
static bool calculateUnixPriority |
( |
int |
priority, |
|
|
int * |
sched_policy, |
|
|
int * |
sched_priority |
|
) |
| |
|
static |
Definition at line 537 of file qthread_unix.cpp.
Referenced by QThread::setPriority(), and QThread::start().
542 *sched_policy = SCHED_RR;
558 #if defined(Q_OS_VXWORKS) && defined(VXWORKS_DKM) 560 prio_min = SCHED_FIFO_LOW_PRI;
561 prio_max = SCHED_FIFO_HIGH_PRI;
563 if ((*sched_policy == SCHED_RR) || (*sched_policy == SCHED_FIFO))
566 prio_min = sched_get_priority_min(*sched_policy);
567 prio_max = sched_get_priority_max(*sched_policy);
570 if (prio_min == -1 || prio_max == -1)
575 prio = ((priority - lowestPriority) * (prio_max - prio_min) / highestPriority) + prio_min;
576 prio =
qMax(prio_min,
qMin(prio_max, prio));
578 *sched_priority = prio;
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
◆ clear_thread_data()
static void clear_thread_data |
( |
| ) |
|
|
static |
◆ create_current_thread_data_key()
static void create_current_thread_data_key |
( |
| ) |
|
|
static |
◆ destroy_current_thread_data()
static void destroy_current_thread_data |
( |
void * |
p | ) |
|
|
static |
Definition at line 131 of file qthread_unix.cpp.
Referenced by create_current_thread_data_key().
133 #if defined(Q_OS_VXWORKS) 158 #
if defined(Q_OS_VXWORKS)
static QObjectPrivate * get(QObject *o)
static const char * data(const QByteArray &arr)
static pthread_key_t current_thread_data_key
static void finish(void *)
The QThread class provides a platform-independent way to manage threads.
◆ destroy_current_thread_data_key()
static void destroy_current_thread_data_key |
( |
| ) |
|
|
static |
Definition at line 170 of file qthread_unix.cpp.
178 pthread_once_t pthread_once_init = PTHREAD_ONCE_INIT;
static void create_current_thread_data_key()
static pthread_once_t current_thread_data_once
static pthread_key_t current_thread_data_key
◆ get_thread_data()
Definition at line 185 of file qthread_unix.cpp.
Referenced by QThreadData::current().
188 return currentThreadData;
static void create_current_thread_data_key()
static pthread_once_t current_thread_data_once
static pthread_key_t current_thread_data_key
◆ set_thread_data()
◆ setCurrentThreadName()
static void setCurrentThreadName |
( |
pthread_t |
threadId, |
|
|
const char * |
name |
|
) |
| |
|
static |
Definition at line 295 of file qthread_unix.cpp.
Referenced by QThreadPrivate::start().
297 # if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE) 299 prctl(PR_SET_NAME, (
unsigned long)
name, 0, 0, 0);
300 # elif (defined(Q_OS_MAC) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) 303 pthread_setname_np(
name);
304 # elif defined(Q_OS_QNX) 305 pthread_setname_np(threadId,
name);
static const MacVersion MacintoshVersion
the version of the Macintosh operating system on which the application is run (Mac only)...
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
◆ thread_sleep()
static void thread_sleep |
( |
struct timespec * |
ti | ) |
|
|
static |
Definition at line 483 of file qthread_unix.cpp.
Referenced by QThread::msleep(), QThread::sleep(), and QThread::usleep().
488 pthread_mutex_init(&mtx, 0);
489 pthread_cond_init(&cnd, 0);
491 pthread_mutex_lock(&mtx);
492 (void) pthread_cond_timedwait(&cnd, &mtx, ti);
493 pthread_mutex_unlock(&mtx);
495 pthread_cond_destroy(&cnd);
496 pthread_mutex_destroy(&mtx);
◆ current_thread_data_key
pthread_key_t current_thread_data_key |
|
static |
◆ current_thread_data_once
pthread_once_t current_thread_data_once = PTHREAD_ONCE_INIT |
|
static |