Subject: regression test regress/lib/libpthread/sigmask3 fails, and should
To: None <current-users@NetBSD.org>
From: Stephan Thesing <thesing@cs.uni-sb.de>
List: current-users
Date: 06/20/2005 13:10:41
Hello,
just out of curiosity a lengthy email:
in regress/lib/libpthread/sigmask3 a `make regress' fails.
Now, I am not sure that it should succeed in the first place:-)
The test installs signal handlers for USR1 and USR2 (lets call them H1, H2) and
then creates a thread (T1). The main thread (MT) then waits for completion of
T1 (pthread_join).
H1 has USR2 masked in its signal mask, so H2 should not be invoked before
H1 finishes.
T1 now sends USR1 to the process. H1, if invoked, emits USR2 and then does
something like `fl=1;'.
In H2, we have something like `if (fl==1) fl=2;'.
Now T1, after emitting USR1 checks if fl==2 and fails the whole program if this
is not the case.
So, the assumption is that the execution sequence is something like
T1
\
->H1
\
->H2
/
T1(ctd)<-
But why should H2 not be invoked in the context of the main thread (which
created T1?) which is just sitting in the pthread_join() and waiting?
Thus, T1 could be continued after emitting USR1, while one or both of H1, H2 are
invoked from the main thread context.
Then, the check for the condition fl==2 in T1 (after the kill(USR1) call) would
be bogus: T1 can run further before the handlers are invoked from the main
thread.
In fact, if one moves the check for the fl==2 condition into the main thread
after the pthread_join(), the check succeeds:-)
So, am I missing something here? Should H1 be invoked from T1 context because
T1 sent the USR1 initially?
Best regards.....
Stephan
= Tel.: +49-681-302-5571 = Universitaet des Saarlandes =
= Fax.: +49-681-302-3065 = Postfach 15 11 50 =
= Compiler Research Group = 66041 Saarbruecken =
= FR 6.2 - Informatik = GERMANY =