public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Nick Garnett <nickg@ecoscentric.com>
To: Dan Jakubiec <djakubiec@yahoo.com>
Cc: ecos-discuss@sources.redhat.com
Subject: Re: [ECOS] POSIX timer callback context
Date: Fri, 31 Oct 2003 18:09:00 -0000	[thread overview]
Message-ID: <m3ad7hxosm.fsf@miso.calivar.com> (raw)
In-Reply-To: <20031030165959.7772.qmail@web21204.mail.yahoo.com>

Dan Jakubiec <djakubiec@yahoo.com> writes:

> Hi Nick,
> 
> Of course I agree that we shouldn't do anything
> non-standard.  I was not suggesting that we restrict
> the signal delivery to *only* go back to the original
> thread.  I was only suggesting that when choosing
> which thread gets the delivered signal, we give
> *preference* to one that initially made the
> timer_settime() call.  If the thread goes away or has
> signals blocked or whatever, then the current
> algorithm is still used to choose a different thread. 
> Since the method of choosing the thread is already
> largly arbitrary, it should make no real difference in
> the POSIX sense.  POSIX just chooses the first
> qualifying thread it finds; why not make it the one
> that set the timer up in the first place (as long as
> it's valid)?

Right, I hadn't quite grasped what you were talking about. That is a
somewhat more acceptable way of behaving. I guess I should have taken
a look at the patch before now :-/

> 
> The SIGEV_SIGNAL_THREAD idea seems interesting, but
> I'm wondering if it will really help.  Ultimately, the
> problem is that I need to interrupt the pselect() call
> of a paritcular thread, which can only be done with a
> signal.  If any signal I send gets delivered
> arbitrarily to any unblocked thread, then there is no
> real way to direct the signal to a particular thread
> without using different signals.  And if you have more
> threads than signals, you're out of luck.
> 
> Does this make sense?
> 

I think, in principle, your idea is fine, and a patch that did this
would probably be acceptable. However, there are a couple of things
that I would like to see fixed before I would be happy with it:

1. The whole functionality should be controlled by a config
   option. That way users for whom this behavior is wrong can turn it
   off.

2. The implementation in your patch would have problems if the caller
   thread has exited when the timer triggers. In that case it would
   end up accessing a pthread_info object that could have been freed
   or reallocated to something else. A better approach would be to
   store a pthread_t and use pthread_info_id() to validate it and
   fetch the pthread_info pointer.

If you were to make those changes, add a ChangeLog entry and post it
to the patches list, I think it would be accepted.


-- 
Nick Garnett                    eCos Kernel Architect
http://www.ecoscentric.com      The eCos and RedBoot experts


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

  reply	other threads:[~2003-10-31 18:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-28 21:09 Dan Jakubiec
2003-10-29 15:33 ` Nick Garnett
2003-10-29 17:04   ` Dan Jakubiec
2003-10-30 15:32     ` Nick Garnett
2003-10-30 17:00   ` Dan Jakubiec
2003-10-31 18:09     ` Nick Garnett [this message]
2003-11-02 23:19       ` Dan Jakubiec
2003-11-03 13:15         ` mbs
2003-11-03 17:57           ` Dan Jakubiec
2003-11-03 18:36             ` mbs
2003-11-03 18:14           ` Dan Jakubiec

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=m3ad7hxosm.fsf@miso.calivar.com \
    --to=nickg@ecoscentric.com \
    --cc=djakubiec@yahoo.com \
    --cc=ecos-discuss@sources.redhat.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).