adding printf for debugging

This commit is contained in:
Dario 2019-10-10 06:49:48 +02:00
parent 9d31478440
commit 77b7251502
2 changed files with 11 additions and 6 deletions

View File

@ -15,10 +15,11 @@ void ElopageWebhook::handleRequest(Poco::Net::HTTPServerRequest& request, Poco::
std::istream& stream = request.stream(); std::istream& stream = request.stream();
Poco::Net::NameValueCollection elopageRequestData; Poco::Net::NameValueCollection elopageRequestData;
while (!stream.eof()) { while (!stream.eof()) {
char keyBuffer[30]; char keyBuffer[30]; memset(keyBuffer, 0, 30);
char valueBuffer[35]; char valueBuffer[35]; memset(valueBuffer, 0, 35);
stream.get(keyBuffer, 30, '=') stream.get(keyBuffer, 30, '=')
.get(valueBuffer, 35, '&'); .get(valueBuffer, 35, '&');
printf("[ElopageWebhook::handleRequest] key: %s, value: %s\n", keyBuffer, valueBuffer);
elopageRequestData.set(keyBuffer, valueBuffer); elopageRequestData.set(keyBuffer, valueBuffer);
} }
UniLib::controller::TaskPtr handleElopageTask(new HandleElopageRequestTask(elopageRequestData)); UniLib::controller::TaskPtr handleElopageTask(new HandleElopageRequestTask(elopageRequestData));

View File

@ -13,7 +13,7 @@ namespace UniLib {
int Thread::init(const char* threadName) int Thread::init(const char* threadName)
{ {
semaphore.wait(); //semaphore.wait();
mPocoThread = new Poco::Thread(threadName); mPocoThread = new Poco::Thread(threadName);
mPocoThread->start(*this); mPocoThread->start(*this);
return 0; return 0;
@ -21,15 +21,19 @@ namespace UniLib {
Thread::~Thread() Thread::~Thread()
{ {
printf("[Thread::~Thread]\n");
if(mPocoThread) if(mPocoThread)
{ {
//Post Exit to Thread //Post Exit to Thread
exitCalled = true; exitCalled = true;
semaphore.wait(); printf("[Thread::~Thread] before semaphore wait\n");
//semaphore.wait();
printf("[Thread::~Thread] after semaphore wait, before condSignal\n");
condSignal(); condSignal();
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");
//SDL_WaitThread(thread, NULL); //SDL_WaitThread(thread, NULL);
//LOG_WARNING_SDL(); //LOG_WARNING_SDL();
delete mPocoThread; delete mPocoThread;
@ -54,7 +58,7 @@ namespace UniLib {
//Thread* t = this; //Thread* t = this;
while (true) { while (true) {
try { try {
semaphore.tryWait(100); //semaphore.tryWait(100);
//printf("[Thread::%s] end worker thread\n", __FUNCTION__); //printf("[Thread::%s] end worker thread\n", __FUNCTION__);
//break; //break;
if (exitCalled) return; if (exitCalled) return;