From a4c24b62c837ea42475c0cc1667a8fd86dfb37c4 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, 5 Oct 2015 08:13:12 +0000 Subject: [PATCH] test2 git-svn-id: svn://db.shs.com.ru/pip@162 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- src/thread/pithread.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/thread/pithread.cpp b/src/thread/pithread.cpp index 428762f6..a5debcda 100755 --- a/src/thread/pithread.cpp +++ b/src/thread/pithread.cpp @@ -127,6 +127,7 @@ bool PIThread::start(int timer_delay) { # endif pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); int ret = pthread_create(&thread, &attr, thread_function, this); + piCout << "pthread_create" << thread; pthread_attr_destroy(&attr); if (ret == 0) { #else @@ -157,6 +158,7 @@ bool PIThread::startOnce() { # endif pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); int ret = pthread_create(&thread, &attr, thread_function_once, this); + piCout << "pthread_create" << thread; pthread_attr_destroy(&attr); if (ret == 0) { #else @@ -179,6 +181,7 @@ bool PIThread::startOnce() { void PIThread::terminate() { if (thread == 0) return; terminating = running_ = false; + piCout << "terminate" << thread; #ifndef WINDOWS # ifdef ANDROID pthread_kill(thread, SIGTERM); @@ -236,6 +239,7 @@ __THREAD_FUNC__ PIThread::thread_function(void * t) { if (ct.lockRun) ct.mutex_.unlock(); ct.terminating = ct.running_ = false; //cout << "thread " << t << " exiting ... " << endl; + piCout << "pthread_exit" << ct.thread; #ifndef WINDOWS pthread_detach(ct.thread); ct.thread = 0; @@ -271,6 +275,7 @@ __THREAD_FUNC__ PIThread::thread_function_once(void * t) { ct.end(); ct.terminating = ct.running_ = false; //cout << "thread " << t << " exiting ... " << endl; + piCout << "pthread_exit" << ct.thread; #ifndef WINDOWS pthread_detach(ct.thread); ct.thread = 0; @@ -318,9 +323,10 @@ void PIThread::setPriority(PIThread::Priority prior) { priority_ = prior; #ifndef WINDOWS if (!running_ && (thread != 0)) return; + piCout << "setPriority" << thread; policy_ = 0; memset(&sparam, 0, sizeof(sparam)); - pthread_getschedparam(pthread_self(), &policy_, &sparam); + pthread_getschedparam(thread, &policy_, &sparam); sparam. # ifndef LINUX sched_priority @@ -328,7 +334,7 @@ void PIThread::setPriority(PIThread::Priority prior) { __sched_priority # endif = priority2System(priority_); - pthread_setschedparam(pthread_self(), policy_, &sparam); + pthread_setschedparam(thread, policy_, &sparam); #else if (!running_ && (thread != 0)) return; SetThreadPriority(thread, priority2System(priority_));