From 35f1923ca93f831c93e64706743e1441226a99b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=8B=D1=87=D0=BA=D0=BE=D0=B2=20=D0=90=D0=BD=D0=B4?= =?UTF-8?q?=D1=80=D0=B5=D0=B9?= Date: Mon, 1 Aug 2016 09:17:13 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/pip@215 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- src/thread/pithread.cpp | 4 ++++ src/thread/pithread.h | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/thread/pithread.cpp b/src/thread/pithread.cpp index 21e0789f..e3a08ce9 100755 --- a/src/thread/pithread.cpp +++ b/src/thread/pithread.cpp @@ -133,7 +133,11 @@ bool PIThread::start(int timer_delay) { //piCout << "pthread_create" << thread; pthread_attr_destroy(&attr); if (ret == 0) { +# ifdef MAC_OS + pthread_threadid_np(thread, &tid) +# else tid_ = thread; +# endif #else if (thread != 0) CloseHandle(thread); thread = (void *)_beginthreadex(0, 0, thread_function, this, 0, 0); diff --git a/src/thread/pithread.h b/src/thread/pithread.h index 9e4273c4..cfaf2ab5 100755 --- a/src/thread/pithread.h +++ b/src/thread/pithread.h @@ -105,7 +105,7 @@ public: PIMutex & mutex() {return mutex_;} //! \brief Returns thread ID - int tid() const {return tid_;} + llong tid() const {return tid_;} EVENT(started) EVENT(stopped) @@ -200,7 +200,8 @@ protected: virtual void end() {;} volatile bool terminating, running_, lockRun; - int delay_, policy_, tid_; + int delay_, policy_; + llong tid_; void * data_; PIMutex mutex_; PITimeMeasurer tmf_, tms_, tmr_;