signal test: fix destruction of nested test

The signal_1/2/3 objects (which are threads) are in destruction, but still
signals are send to them. When the signal arrive and the memory for the
signal_1/2/3 object is already invalid we operate on stale memory and all
the locking infrastructure of the Thread don't work anymore.

Be more robust, explicitly wait for the termination of the thread.

Issue #2284
This commit is contained in:
Alexander Boettcher 2017-03-08 08:48:20 +01:00 committed by Christian Helmuth
parent f1b632af68
commit beb5169ee9

View File

@ -617,6 +617,9 @@ struct Nested_stress_test : Signal_test
~Nested_stress_test()
{
/* tell timer not to send any signals anymore. */
timer.sigh(Timer::Session::Signal_context_capability());
/* let senders stop burning our CPU time */
sender_1.destruct = true;
sender_2.destruct = true;
@ -634,6 +637,9 @@ struct Nested_stress_test : Signal_test
sender_1.transmitter.submit();
sender_2.transmitter.submit();
sender_3.transmitter.submit();
/* wait until threads joined */
sender_1.join(); sender_2.join(), sender_3.join();
}
void handle_poll()