[hatari-devel] RS-232 code crappiness & what to do about it?
Eero Tamminen
eerot at users.berlios.de
Mon Nov 1 23:41:29 CET 2010
Hi,
I was running Valgrind's Helgrind (thread data race debugger) on Hatari
and it complained about potential issue with the RS-232 code.
When reading the code, the reported thing didn't seem to be an issue in
practice, but I noticed that the code will always create a thread to handle
the RS-232 input, _regardless_ of whether (valid) files have been specified
for RS-232...
If there are no valid files, the thread will just uselessly poll internal
variables at 20ms internal.
The comment for RS232_Init() says that "we will open a connection when first
bytes are sent", but RS-232 files are actually always opened in the init()
function, if it's enabled & files are specified. The thread is created in
RS-232 init() regardless of whether opening these files succeeds. And
the thread is removed at uninit().
Do you see a problem if the thread & file opens would be done only
in init() and removed at uninit() instead of the files being potentially
opened also from RS232_TransferBytesTo()?
Or maybe it would be better to do the thread in the same place
where the files are opened and only if the input file open succeeds?
- Eero
More information about the hatari-devel
mailing list