[gccsdk] Threading + Alt-Break = Trashed Computer

Ben Avison bavison at riscosopen.org
Fri Jul 11 14:29:18 PDT 2008

John Tytgat <John.Tytgat at aaug.net> wrote:
> In message <op.ud3ma5pfl0n5eg at balaptop.ba>
>           "Ben Avison" <bavison at riscosopen.org> wrote:
>> The watchdog sets a transient callback from the key event, and in the
>> callback it does a task switch (without going through Wimp_Poll) and  
>> calls SWI OS_Exit.
>> The neatest thing you could do would be to install an exit handler to  
>> remove the filters.
> Actually UnixLib has an exit handler [...]

You know what, I think this looks like a Wimp bug. The fact that the Watchdog
was doing a primitive task switch and then calling OS_Exit had me wondering
about how come the correct exit handler was called - the answer seems to be
it isn't. As a quick test, I used the following BASIC program:

  10 SYS "OS_ChangeEnvironment",11,&10000000

Run the program, do Alt-Break, kill the task itself (task "Unknown"), result
is prefetch abort at &10000004, as expected. Now try again, this time click
"Next task" to select another task, kill that instead, result is a stiffed
machine. This indicates that the environment isn't being switched and the
Wimp is doing a poor job of recovering from the error.

Presumably in the UnixLib case, the task that was running when the Break
key event goes off only has the default Wimp exit handler installed. This
wouldn't directly cause an abort, but it would have the effect that the
UnixLib exit handler is bypassed and so its filters don't get removed.

If this is as true as it appears, I'm amazed such a fundamental bug in the
Watchdog has gone unnoticed as long as it has!


More information about the gcc mailing list