some issue with stack size ..

This commit is contained in:
Robin Müller 2020-06-06 15:01:57 +02:00
parent 212cd58f9a
commit ef01b78140
3 changed files with 16 additions and 9 deletions

View File

@ -38,7 +38,8 @@ ReturnValue_t PeriodicPosixTask::sleepFor(uint32_t ms) {
ReturnValue_t PeriodicPosixTask::startTask(void){ ReturnValue_t PeriodicPosixTask::startTask(void){
started = true; started = true;
createTask(&taskEntryPoint,this); //sif::info << stackSize << std::endl;
PosixThread::createTask(&taskEntryPoint,this);
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }

View File

@ -128,6 +128,9 @@ void PosixThread::createTask(void* (*fnc_)(void*), void* arg_) {
default attributes. default attributes.
*/ */
pthread_attr_t attributes; pthread_attr_t attributes;
//PeriodicPosixTask* task = reinterpret_cast<PeriodicPosixTask*>(arg_);
//sif::info << task->stackSize << std::endl;
sif::info << stackSize << std::endl;
int status = pthread_attr_init(&attributes); int status = pthread_attr_init(&attributes);
if(status != 0){ if(status != 0){
sif::error << "Posix Thread attribute init failed with: " << sif::error << "Posix Thread attribute init failed with: " <<

View File

@ -54,14 +54,17 @@ protected:
pthread_t thread; pthread_t thread;
/** /**
* @brief Function that has to be called by derived class because the derived class pointer has to be valid as argument * @brief Function that has to be called by derived class because the
* @details This function creates a pthread with the given parameters. As the function requires a pointer to the derived object * derived class pointer has to be valid as argument
* it has to be called after the this pointer of the derived object is valid. Sets the taskEntryPoint as * @details
* function to be called by new a thread. * This function creates a pthread with the given parameters. As the
* @param name_ Name of the task * function requires a pointer to the derived object it has to be called
* @param priority_ Priority of the task according to POSIX * after the this pointer of the derived object is valid.
* @param stackSize_ Size of the stack attached to that task * Sets the taskEntryPoint as function to be called by new a thread.
* @param arg_ argument of the taskEntryPoint function, needs to be this pointer of derived class * @param fnc_ Function which will be executed by the thread.
* @param arg_
* argument of the taskEntryPoint function, needs to be this pointer
* of derived class
*/ */
void createTask(void* (*fnc_)(void*),void* arg_); void createTask(void* (*fnc_)(void*),void* arg_);