All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: "Petr Červenka" <grugh@centrum.cz>, Xenomai <xenomai@xenomai.org>
Subject: Re: rt_task_unblock() POSIX alternative
Date: Tue, 7 Apr 2020 17:29:38 +0200	[thread overview]
Message-ID: <e934d96a-28d9-1c41-69a3-2d82cd1387f0@siemens.com> (raw)
In-Reply-To: <20200407171816.E0B3979D@centrum.cz>

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.

Jan

> Petr
>   
> ______________________________________________________________
>>  From "Jan Kiszka" <jan.kiszka@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.
>   
>   Jan
>   
>   --
>   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


  reply	other threads:[~2020-04-07 15:29 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-07 13:41 rt_task_unblock() POSIX alternative Petr Červenka
2020-04-07 14:59 ` Jan Kiszka
2020-04-07 15:18   ` Petr Červenka
2020-04-07 15:29     ` Jan Kiszka [this message]
2020-04-07 15:30     ` Richard Weinberger
2020-04-08  9:44       ` Petr Červenka
2020-04-08 10:06         ` Richard Weinberger
2020-04-08 21:36         ` Richard Weinberger
2020-04-09 15:00           ` Petr Červenka
2020-04-09 16:13             ` Richard Weinberger
2020-04-09 18:10               ` Petr Červenka
2020-04-09 18:48                 ` Richard Weinberger
2020-04-14  8:16                   ` Petr Červenka
2020-04-14  8:30                     ` Richard Weinberger
2020-04-14  9:10                       ` Petr Červenka
2020-04-14  9:46                         ` Richard Weinberger
2020-04-14 10:07                           ` Jan Kiszka
2020-04-14 10:23                             ` Richard Weinberger
2020-04-14 10:28                               ` Jan Kiszka
2020-04-14 10:41                                 ` Richard Weinberger
2020-04-14 10:43                                   ` Jan Kiszka
2020-04-14 10:56                                     ` Richard Weinberger
2020-04-14 11:01                                       ` Jan Kiszka
2020-04-14 11:05                                         ` Richard Weinberger
2020-04-14 11:30                                           ` Jan Kiszka
2020-04-14 10:39                             ` Petr Červenka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e934d96a-28d9-1c41-69a3-2d82cd1387f0@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=grugh@centrum.cz \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.