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

This commit is contained in:
2016-08-01 11:27:18 +00:00
parent 35f1923ca9
commit 08b56782b1
2 changed files with 9 additions and 2 deletions

View File

@@ -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__;

View File

@@ -24,6 +24,9 @@
#ifdef WINDOWS
void __PISetTimerResolution() {if (setTimerResolutionAddr == NULL) return; ULONG ret; setTimerResolutionAddr(1, TRUE, &ret);}
#endif
#ifdef MAC_OS
# include <pthread.h>
#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);