Mail Archives: cygwin/2005/10/11/10:50:07
---559023410-580310325-1129042260=:1476
Content-Type: TEXT/PLAIN; charset=US-ASCII
On Thu, 6 Oct 2005, Pavel Tsekov wrote:
> On Thu, 6 Oct 2005, Christopher Faylor wrote:
>
> > >It might be a different problem but the message is the same.
> >
> > It *is* a different problem.
>
> Ok.
>
> > Some thread is sending a signal 31 (SIGUSR1). Which thread is doing this?
>
> An application thread signaling another thread to stop its execution. I am
> on it - I'll report back if I manage to find something.
While tracking this problem I found what I suspect is a small bug in
the way sigsuspend() works when it is used to retrieve the list of pending
signals for a thread other than the main one. I think this is related to
the crash I am seeing in some way though this has to be determined yet.
As I read the code, when retrieving the list of pending signals
sigpending() inspects only the list of blocked signals for the main
thread - it doesn't look in the thread specific list of blocked signals
of the calling thread.
The code which I refer to is the following block from wait_sig():
case __SIGPENDING:
*pack.mask = 0;
unsigned bit;
sigq.reset ();
while ((q = sigq.next ()))
if (myself->getsigmask () & (bit = SIGTOMASK (q->si.si_signo)))
*pack.mask |= bit;
break;
On the other hand the code in sigpacket::process() does the right thing
when it delivers a signal i.e. it looks the list of blocked signals in
both the main thread and the target thread.
Attached is a simple test case which demonstrates the problem.
On Linux:
pending_set = 00000000
pending_set = 00000000
pending_set = 00000000
pending_set = 00000000
pending_set = 00000000
pending_set = 00000800
exiting thread_loop()
On Cygwin:
pending_set = 00000000
pending_set = 00000000
pending_set = 00000000
pending_set = 00000000
pending_set = 00000000
pending_set = 00000000
pending_set = 00000000
pending_set = 00000000
pending_set = 00000000
pending_set = 00000000
pending_set = 00000000
pending_set = 00000000
pending_set = 00000000
[ keeps looping forever ]
---559023410-580310325-1129042260=:1476
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="sigpending_thr.c"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine DOT CYG DOT 4 DOT 58 DOT 0510111751001 DOT 1476 AT mordor>
Content-Description:
Content-Disposition: attachment; filename="sigpending_thr.c"
I2luY2x1ZGUgPHNpZ25hbC5oPg0KI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ZXhpdCAoMSk7DQogICAgfQ0KDQogIC8qIGdpdmUgdGhlIHNl
Y29uZCB0aHJlYWQgYSBjaGFuY2UgdG8gcnVuICovDQogIHNsZWVwICg1KTsN
Cg0KICB3aGlsZSAoMSkNCiAgICB7DQogICAgICBpZiAocHRocmVhZF9raWxs
ICh0aHJfaWQsIFNJR1VTUjIpICE9IDApDQogICAgICAgIGJyZWFrOw0KICAg
IH0NCg0KICBleGl0ICgwKTsNCn0NCg==
---559023410-580310325-1129042260=:1476
Content-Type: text/plain; charset=us-ascii
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
---559023410-580310325-1129042260=:1476--
- Raw text -