From 08b56782b165d48abc458c8ed34e761376d08976 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 11:27:18 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/pip@216 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- src/core/piinit.cpp | 2 +- src/thread/pithread.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/core/piinit.cpp b/src/core/piinit.cpp index d946f2cb..7063eba3 100644 --- a/src/core/piinit.cpp +++ b/src/core/piinit.cpp @@ -298,7 +298,7 @@ __PIInit_Initializer__::__PIInit_Initializer__() { __PIInit_Initializer__::~__PIInit_Initializer__() { count_--; - if (count_ > 1) return; + if (count_ > 0) return; //piCout << "delete PIInit"; if (__instance__ != 0) { delete __instance__; diff --git a/src/thread/pithread.cpp b/src/thread/pithread.cpp index e3a08ce9..8f794e54 100755 --- a/src/thread/pithread.cpp +++ b/src/thread/pithread.cpp @@ -24,6 +24,9 @@ #ifdef WINDOWS void __PISetTimerResolution() {if (setTimerResolutionAddr == NULL) return; ULONG ret; setTimerResolutionAddr(1, TRUE, &ret);} #endif +#ifdef MAC_OS +# include +#endif /*! \class PIThread @@ -134,7 +137,7 @@ bool PIThread::start(int timer_delay) { pthread_attr_destroy(&attr); if (ret == 0) { # ifdef MAC_OS - pthread_threadid_np(thread, &tid) + pthread_threadid_np(thread, (__uint64_t*)&tid) # else tid_ = thread; # endif @@ -169,7 +172,11 @@ bool PIThread::startOnce() { //piCout << "pthread_create" << thread; pthread_attr_destroy(&attr); if (ret == 0) { +# ifdef MAC_OS + pthread_threadid_np(thread, (__uint64_t*)&tid) +# else tid_ = thread; +# endif #else if (thread != 0) CloseHandle(thread); thread = (void *)_beginthreadex(0, 0, thread_function_once, this, 0, 0);