From: "Frantisek Rysanek" <Frantisek.Rysanek@post.cz>
To: linux-kernel@vger.kernel.org
Cc: bill o gallmeister <bog.kernel@gmail.com>
Subject: Re: setitimer vs. threads: SIGALRM returned to which thread? (process master or individual child)
Date: Sat, 10 Apr 2010 09:26:24 +0200 [thread overview]
Message-ID: <4BC04440.17716.2AAF4DA@Frantisek.Rysanek.post.cz> (raw)
In-Reply-To: <4BBF9B8F.3030106@gmail.com>
On 9 Apr 2010 at 23:26, bill o gallmeister wrote:
>
> Check out timer_create() rather than setitimer().
>
Oh I *see* :-) There seems to be a way to deliver an event to a
specific thread. Just a quick guess, haven't validated this by a
compiler:
============ PSEUDOCODE SNIPPET ==========
struct my_thr_data
{
pthread_t ID; /* to be set upon pthread_create() */
/* ...further members... */
};
void* my_fn(void* my_user_data)
{
pthread_kill( ((my_thr_data*)my_user_data)->ID, SIGALRM);
}
struct my_thr_data this_thread;
timer_t my_timer;
struct sigevent my_event =
{
sigev_notify: SIGEV_THREAD,
sigev_notify_function: my_fn,
sigev_value.sival_ptr: &this_thread,
sigev_notify_attributes: NULL
}
timer_create(CLOCK_REALTIME, &my_event, &my_timer);
/* by now we're set up, but the timer doesn't tick yet. */
/* someplace later in the code: */
timer_settime(my_timer, ... );
=========== /PSEUDOCODE SNIPPET ==============
thank you :-)
Frank Rysanek
next prev parent reply other threads:[~2010-04-10 7:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-09 19:48 Frantisek Rysanek
[not found] ` <4BBF9B8F.3030106@gmail.com>
2010-04-10 7:26 ` Frantisek Rysanek [this message]
2010-04-11 20:56 ` Andi Kleen
2010-04-11 21:52 ` Davide Libenzi
2010-04-11 22:09 ` Thomas Gleixner
2010-10-17 20:42 ` Frantisek Rysanek
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=4BC04440.17716.2AAF4DA@Frantisek.Rysanek.post.cz \
--to=frantisek.rysanek@post.cz \
--cc=bog.kernel@gmail.com \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®