threads: add logging
This commit is contained in:
@@ -6,17 +6,21 @@
|
||||
*/
|
||||
|
||||
#include "ThreadCommon.h"
|
||||
#include "Log.h"
|
||||
|
||||
ThreadCommon::QueueManager::QueueManager() {}
|
||||
|
||||
bool ThreadCommon::QueueManager::createQueue(size_t queue_length, size_t item_size, Queue_id qid)
|
||||
{
|
||||
QueueHandle_t queue_to_create;
|
||||
LOG_DEBUG("Creating queue with id %d", qid);
|
||||
if ((queue_to_create = xQueueCreate(queue_length, item_size)))
|
||||
{
|
||||
LOG_DEBUG("Queue with id %d has been created", qid);
|
||||
queues.insert({qid, queue_to_create});
|
||||
return true;
|
||||
}
|
||||
LOG_ERROR("Failed to cerate queue with id %d", qid);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "ThreadCommon.h"
|
||||
#include "Log.h"
|
||||
|
||||
|
||||
ThreadCommon::ThreadManager::ThreadManager(){}
|
||||
@@ -10,12 +11,18 @@ bool ThreadCommon::ThreadManager::createTask(void (*task_func)(void*),
|
||||
void* parameters)
|
||||
{
|
||||
const char * t_name = name.c_str();
|
||||
LOG_DEBUG("Creating task [name: %s, priority: %ld, stack: %ld]",
|
||||
t_name, priority, stack_size);
|
||||
BaseType_t taskCreated = xTaskCreate(task_func,
|
||||
t_name,
|
||||
stack_size,
|
||||
parameters,
|
||||
priority,
|
||||
NULL);
|
||||
assert(taskCreated == pdPASS);
|
||||
if (!(taskCreated == pdPASS))
|
||||
{
|
||||
LOG_ERROR("Failed to create a task [name: %s, priority: %ld, stack: %ld]",
|
||||
t_name, priority, stack_size)
|
||||
}
|
||||
return (taskCreated == pdPASS);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user