I am working on a big project that uses RTAI both in kernel and user spaces. I won't get into the details of the project, but here is briefly where a problem arises.
In user-space, my project provides a library used by other people to write some software. Those programs themselves may have RTAI real-time threads.
Now, some functions in RTAI require that their calling thread have already rt_thread_init
ed so if I want to use them in a function in the library, I need to temporarily make the calling thread real-time by calling rt_thread_init
and later rt_task_delete
.
Now here's the problem:
If the calling thread of my function IS already real-time, then I am rt_thread_init
ing which I assume simply fails, but then I rt_task_delete
and make that thread non-real-time (besides the fact that when the thread itself (assuming I changed nothing) again rt_task_delete
s, RTAI crashes.
If the calling thread of my function IS not real-time, everything is ok.
For now, I resorted to taking a parameter in the function so that the calling function tells the library if it is real-time or not. However, I wanted to know if RTAI has a function or something so I could use to automatically detect whether the current thread is real-time or not.
Don't know if there are any RTAI users here (I certainly didn't see the RTAI tag), but hope there would be.