From: Jonathan Larmour <jlarmour@redhat.com>
To: "Boris V. Guzhov" <borg@int.spb.ru>
Cc: ecos-discuss@sourceware.cygnus.com
Subject: Re: [ECOS] select() and signal's
Date: Fri, 20 Apr 2001 13:11:00 -0000 [thread overview]
Message-ID: <3AE097E4.54468B43@redhat.com> (raw)
In-Reply-To: <01f801c0c9ab$be16cdd0$7601a8c0@borg>
"Boris V. Guzhov" wrote:
>
> But it still not works.
> Both threads have an equal priority.
> I carefully has looked on cyg_sigqueue() code.
> And I don't understand as cyg_sigqueue() function will wake
> the blocked in select() thread.
> The cyg_sigqueue() function calls only signal_sigwait.broadcast().
> But the blocked thread sleeps on other condition variable - selwait,
> but not on signal_sigwait.
Try the attached patch and let me know how you get on. I've only done some
simple tests. But I want you to try it with your existing code rather than
me spending more time on it[1]. *Do* let me know the outcome.
Jifl
[1] Since you're not a customer :)
--
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine
? foo
Index: signal.cxx
===================================================================
RCS file: /home/cvs/ecc/ecc/compat/posix/current/src/signal.cxx,v
retrieving revision 1.11
diff -u -5 -p -r1.11 signal.cxx
--- signal.cxx 2001/02/14 01:25:44 1.11
+++ signal.cxx 2001/04/20 20:08:54
@@ -61,12 +61,13 @@
#include <signal.h> // our header
#include <setjmp.h>
#include <unistd.h> // _exit
#include <cyg/kernel/clock.hxx>
-
+#include <cyg/kernel/thread.hxx>
#include <cyg/kernel/clock.inl>
+#include <cyg/kernel/thread.inl>
// -------------------------------------------------------------------------
// Internal definitions
// Handle entry to a signal package function.
@@ -239,16 +240,33 @@ cyg_bool cyg_sigqueue( const struct sige
ss->pending = si;
}
// else A non-queuable signal, just set it pending
if( thread != NULL )
+ {
sigaddset( &thread->sigpending, signo );
- else sigaddset( &sig_pending, signo );
+ // just wake the thread up now if it's blocked somewhere
+ if ((thread->sigpending & ~thread->sigmask) != 0)
+ {
+ thread->thread->set_asr_pending();
+ thread->thread->release();
+ }
+ }
+ else
+ {
+ sigaddset( &sig_pending, signo );
+ // Wake up any threads in sigsuspend() and sigwait().
+ if (!signal_sigwait.get_queue()->empty())
+ {
+ signal_sigwait.broadcast();
+ }
+ else
+ {
+ cyg_posix_pthread_release_thread( &sig_pending );
+ }
+ }
- // Wake up any threads in sigsuspend() and sigwait().
- signal_sigwait.broadcast();
-
if( !locked ) signal_mutex.unlock();
return true;
}
next prev parent reply other threads:[~2001-04-20 13:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-20 5:42 Boris V. Guzhov
2001-04-20 6:57 ` Jonathan Larmour
2001-04-20 8:13 ` Boris V. Guzhov
2001-04-20 13:11 ` Jonathan Larmour [this message]
2001-04-21 5:52 ` Boris V. Guzhov
2001-04-21 6:02 ` Boris V. Guzhov
2001-04-23 12:32 ` Jonathan Larmour
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=3AE097E4.54468B43@redhat.com \
--to=jlarmour@redhat.com \
--cc=borg@int.spb.ru \
--cc=ecos-discuss@sourceware.cygnus.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).