问题标签 [lxrt]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
linux - 如何检测函数的调用线程是否已经是 RTAI 实时的?
我正在做一个在内核和用户空间中都使用 RTAI 的大型项目。我不会详细介绍该项目,但这里简要介绍了出现问题的地方。
在用户空间,我的项目提供了一个库,供其他人用来编写一些软件。这些程序本身可能具有 RTAI 实时线程。
现在,RTAI 中的一些函数要求它们的调用线程已经ed,所以如果我想在库中的函数中使用它们,我需要通过调用和 laterrt_thread_init
临时使调用线程实时。rt_thread_init
rt_task_delete
现在问题来了:
如果我的函数的调用线程已经是实时的,那么我rt_thread_init
假设它只是失败了,但是然后我rt_task_delete
并使该线程成为非实时的(除了当线程本身(假设我什么都没改变)再次rt_task_delete
,RTAI 崩溃。
如果我的函数的调用线程不是实时的,一切都很好。
现在,我在函数中采用了一个参数,以便调用函数告诉库它是否是实时的。但是,我想知道 RTAI 是否有功能或其他东西,以便我可以用来自动检测当前线程是否是实时的。
不知道这里有没有 RTAI 用户(我当然没看到 RTAI 标签),但希望有。
c++ - Should I join a thread that has been killed?
I have many joinable threads that at some point need to all stop. The threads are pthread, but are created through RTAI's user-space interface (never mind the RTAI though).
For each thread I have a variable that I can set to tell them to quit. So what I do is:
- set that variable for each thread so that they stop
- Wait at most one second
- join the threads
Now the thing is, since I am using RTAI, which uses a kernel-space buddy thread to the work for me, if something goes wrong, the thread may go unresponsive (It has never happened, but I have to be careful just in case something DOES go wrong). In such a case, I just kill the thread.
So, my question is, once you have a thread that is killed, should you join
on it or not?