rt_task_unblock() POSIX alternative
jan.kiszka at siemens.com
Tue Apr 7 17:29:38 CEST 2020
On 07.04.20 17:18, Petr Červenka wrote:
> Hello Jan.
> And if I don't want to totally remove the thread? Only to interrupt the waiting and react according to new events (like reconfiguring something or starting to wait on different resource).
> Is there some pthread_create... or sched_... parameter or flag, that the task's system call can be interruptible?
> And how to use the signals to interrupt it? Call of kill(task_pid, SIGINT) didn't helped.
Use __STD(pthread_kill) to target a specific thread.
But if you want to continue the thread after interruption, you may be
looking for a RT channel. In that case, poll on the timerfd and a
messaging channel like an mqueue or an iddp socket is more appropriate.
>> From "Jan Kiszka" <jan.kiszka at siemens.com>
> On 07.04.20 15:41, Petr Červenka via Xenomai wrote:
> > Hello everyone.
> > I there a rt_task_unblock() Xenomai POSIX skin alternative?
> > I created an example of periodic POSIX task, similar to the latency example but with very long period. When I receive a INT signal I set the end flag and I would like to unblock a task that waits on read(timerfd). But all my attempts led to standard wait timeout or worse.
> Try pthread_cancel(). If you need to run some cleanup code in the target
> thread, use pthread_cleanup_push. None of that would be with real-time
> qualities, though. But I assume that the cleanup is not a time-critical
> path, is it?
> Sending a Linux signal would be another way to interrupt the target task.
> Siemens AG, Corporate Technology, CT RDA IOT SES-DE
> Corporate Competence Center Embedded Linux
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
More information about the Xenomai