TaskWindow: SWIs don't return on TaskWindow exit
Timothy Baldwin (184) 242 posts |
Consider this loop, in a module command handler so running in (para-virtualised) supervisor mode:
If I run it in a TaskWindow, and close the TaskWindow whilst it running either OS_Byte or OS_WriteN does not return, the thread just disappears without trace, ix_close(ptmx) isn’t executed and one or more Linux processes continue to run. I made a portable test case, expected behaviour is that a TaskWindow should fail to close.
The result is that TaskWindows close without error throughout the 11 years history of IOMD32 RISC OS 5. It appears from the TaskWindow source code, that ErrorBlock_TaskWindow_Dying should be returned, but what should happen after the supervisor stack is unwound? And yes, this is the same function as last weeks bug. :-) |
Julie Stamp (8365) 474 posts |
That’s interesting. To restate the issue, if you run the BASIC program in a task window, and then select Quit from the task manager, the task doesn’t quit. If we go
we see that the SWI does return the error as expected. To make it return each time you have to press a key again. (MsgMon is also useful for looking at this kind of thing.) The task will not exit whilst it remains in supervisor mode; you’d have to do SWI XOS_LeaveOS. In terms of your C code, can you give a similar portable assembler example that shows the problem with OS_WriteN or OS_Byte INKEY since there’s no issue with OS_ReadC? I had a go with INKEY and it seemed to return. |
Timothy Baldwin (184) 242 posts |
I think I’ve tracked it down, Message_Quit, which is sent by the TaskManager works but TaskWindow_Morite, which is sent by Zap and Edit when closing the window doesn’t. It erroneously immediately calling OS_Exit when a TaskWindow_Morite message was received. I’ve submitted a simple fix:
|