git-svn-id: svn://db.shs.com.ru/pip@516 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2017-06-21 21:57:25 +00:00
parent b8e3094099
commit d2bded692e
4 changed files with 65 additions and 19 deletions

View File

@@ -27,6 +27,10 @@
#else
# define __THREAD_FUNC_RET__ void*
#endif
#if defined(LINUX)
# include <sys/syscall.h>
# define gettid() syscall(SYS_gettid)
#endif
#if defined(MAC_OS) || defined(BLACKBERRY)
# include <pthread.h>
#endif
@@ -213,8 +217,9 @@ bool PIThread::start(int timer_delay) {
if (ret == 0) {
# ifdef MAC_OS
pthread_threadid_np(PRIVATE->thread, (__uint64_t*)&tid_);
# else
tid_ = PRIVATE->thread;
//# else
// pthread_threadid_np();
// tid_ = PRIVATE->thread;
# endif
#else
if (PRIVATE->thread != 0) CloseHandle(PRIVATE->thread);
@@ -249,8 +254,8 @@ bool PIThread::startOnce() {
if (ret == 0) {
# ifdef MAC_OS
pthread_threadid_np(PRIVATE->thread, (__uint64_t*)&tid_);
# else
tid_ = PRIVATE->thread;
//# else
// tid_ = PRIVATE->thread;
# endif
#else
if (PRIVATE->thread != 0) CloseHandle(PRIVATE->thread);
@@ -386,6 +391,9 @@ void PIThread::__thread_func__(void * t) {
PIThread & ct = *((PIThread * )t);
#ifdef WINDOWS
ct.tid_ = GetCurrentThreadId();
#endif
#ifdef LINUX
ct.tid_ = gettid();
#endif
PIINTROSPECTION_REGISTER_THREAD(ct.tid(), ct.priority(), ct.name());
REGISTER_THREAD(&ct);
@@ -457,6 +465,9 @@ void PIThread::__thread_func_once__(void * t) {
PIThread & ct = *((PIThread * )t);
#ifdef WINDOWS
ct.tid_ = GetCurrentThreadId();
#endif
#ifdef LINUX
ct.tid_ = gettid();
#endif
PIINTROSPECTION_REGISTER_THREAD(ct.tid(), ct.priority(), ct.name());
REGISTER_THREAD(&ct);