Hi!
I'm trying to write a small library for myself. It would need a thread to do some background stuff. In my library I would have a stuffInit() function to set up things, but I don't want much to happen before calling this function (it it will be called at all...) I don't want the thread to start before I call stuffInit(). I would like to declare it suspended. My problem is the following:
void stuffThread() { } K_THREAD_DEFINE(stuffThreadId, 512, stuffThread, NULL, NULL, NULL, 3, 0, 200); k_thread_suspend(stuffThreadId); void initStuff() { k_thread_resume(stuffThreadId); }
I can't do that, because k_thread_suspend(stuffThreadId); can't be just lying there outside of the function.
void stuffThread() { } void initStuff() { K_THREAD_DEFINE(stuffThreadId, 512, stuffThread, NULL, NULL, NULL, 3, 0, 0); }
I can't do that wither, because I can't define the thread in a function.
Is there a way to declare it suspended, or in a way that it doesn't start doing stuff until I say so?
Thanks!