-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Examples #7
Comments
Have you created an object of type WriteTask? I generally create it at file scope so it is created before main starts. |
Hi Richard, Yes, I do create the object at runtime (on demand). The task itself is created (I can see it in the thread list) though the virtual task() override is never executed for some odd reason. Didn't know if I was missing something. Cheers |
If you are creating the task dynamically, is the task creating it higher in priority then this task? There is some code that if you enable the get/set task priority it will try to adjust things to make it work, but that isn't as well tested. If you haven't enabled the set priority function in FreeRTOSConfig.h, then you must create tasks with a task of higher priority than you are making them or it will run before the constructor finishes. |
I have tried both higher and lower on the task priority. INCLUDE_vTaskPrioritySet is set in the config To create the task, I am simply instantiating it.
taskfun() (line 370) doesn't execute before the deconstructor is called (and the task is deleted). I believe it's because I'm losing reference to the WriteTask object therefore it is destroyed. With that said, is proper use to create the object, suspend the task, and hang onto it until needed? |
If the task object gets destroyed, the task is deleted, so you don't want to make it as an automatic variable inside a function. Either make it as a file scope if it is to always be there, or you need to create the variable on the heap (and make sure your new function is thread safe) with something like WriteTask* task = new WriteTask; The one trick here is you need to then somehow make sure the object is deleted when your task is done (and it can't delete itself). |
Any chance for some examples on how to use the framework for us newbies?
header
cpp
my task function never gets executed, seems to delete the task before anything happens.
CHeers
The text was updated successfully, but these errors were encountered: