8 years ago.

Can you use a RTOS thread inside a library

I am wanting to write a library which when started will poll certain pins passed into it untill requested to stop. I am using the RTOS library and I can use the threads in the main code but I have some concerns about using it in a library and cant seem to find the answer.

My main concern is once a thread is running inside a library (called from main code) can another function inside the library run while the thread is running or will it wait until the thread finishes.

Could someone help me answer this please?

1 Answer

8 years ago.

That depends on the priority of the threads, and if you let them wait on something or not. If you have a high priority thread running continiously, other threads cannot run.

ok brill, im having an issue trying to get it to work. Im defining it like I would in the top level code (Thread therad(runtimeThread);)but i get the following error:

Error: No instance of constructor "rtos::Thread::Thread" matches the argument list

not sue where this has come from but I assume its because its within a library. how would you declare and set the thread running in the library?

posted by Nick Oliver 02 Mar 2016