remove printf for debugging, remove semaphore from thread

This commit is contained in:
Dario 2019-10-10 06:52:48 +02:00
parent 77b7251502
commit c40cef59f5
3 changed files with 8 additions and 8 deletions

View File

@ -22,7 +22,7 @@ namespace UniLib {
CPUSheduler::~CPUSheduler() CPUSheduler::~CPUSheduler()
{ {
printf("[CPUSheduler::~CPUSheduler]\n"); //printf("[CPUSheduler::~CPUSheduler]\n");
for(int i = 0; i < mThreadCount; i++) { for(int i = 0; i < mThreadCount; i++) {
if (mThreads[i]) { if (mThreads[i]) {
delete mThreads[i]; delete mThreads[i];
@ -30,7 +30,7 @@ namespace UniLib {
} }
delete[] mThreads; delete[] mThreads;
mThreadCount = 0; mThreadCount = 0;
printf("[CPUSheduler::~CPUSheduler] finished\n"); //printf("[CPUSheduler::~CPUSheduler] finished\n");
} }
int CPUSheduler::sheduleTask(TaskPtr task) int CPUSheduler::sheduleTask(TaskPtr task)

View File

@ -6,7 +6,7 @@ namespace UniLib {
namespace lib { namespace lib {
Thread::Thread(const char* threadName/* = NULL*/, bool createInConstructor/* = true*/) Thread::Thread(const char* threadName/* = NULL*/, bool createInConstructor/* = true*/)
: mPocoThread(nullptr), semaphore(1), exitCalled(false) : mPocoThread(nullptr), exitCalled(false)
{ {
if (createInConstructor) init(threadName); if (createInConstructor) init(threadName);
} }
@ -26,14 +26,14 @@ namespace UniLib {
{ {
//Post Exit to Thread //Post Exit to Thread
exitCalled = true; exitCalled = true;
printf("[Thread::~Thread] before semaphore wait\n"); //printf("[Thread::~Thread] before semaphore wait\n");
//semaphore.wait(); //semaphore.wait();
printf("[Thread::~Thread] after semaphore wait, before condSignal\n"); //printf("[Thread::~Thread] after semaphore wait, before condSignal\n");
condSignal(); condSignal();
printf("[Thread::~Thread] after condSignal, before thread join\n"); //printf("[Thread::~Thread] after condSignal, before thread join\n");
//SDL_Delay(500); //SDL_Delay(500);
mPocoThread->join(); mPocoThread->join();
printf("[Thread::~Thread] after thread join\n"); //printf("[Thread::~Thread] after thread join\n");
//SDL_WaitThread(thread, NULL); //SDL_WaitThread(thread, NULL);
//LOG_WARNING_SDL(); //LOG_WARNING_SDL();
delete mPocoThread; delete mPocoThread;

View File

@ -69,7 +69,7 @@ namespace UniLib {
Poco::Mutex mutex; Poco::Mutex mutex;
Poco::Thread* mPocoThread; Poco::Thread* mPocoThread;
Poco::Condition condition; Poco::Condition condition;
Poco::Semaphore semaphore; //Poco::Semaphore semaphore;
bool exitCalled; bool exitCalled;
}; };