Re: [hatari-devel] Deadlock while closing serial port |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] Deadlock while closing serial port
- From: Thomas Huth <th.huth@xxxxxxxxx>
- Date: Sun, 24 Apr 2022 17:04:34 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1650819877; bh=5bnDQ6Cp8NlwTMIt8SbA4W++XQpILJmtZ9ipHEoNnPA=; h=Date:From:To:Subject:From; b=UfdJ8hToqPeukKpR11wOpL19YU+E3lPyldRh21Zty2vE01g1ue4lBzSQzt5UE4QXF VQpkrKF+mw+EjynnopDvd1JabSjqwUDFGKn4v3zwFY1K2/x+0oLVQjARiZYYkEKxpz REZkNdI5xAf97x7c2VZbSu9IwxhVS2mn7EFJY1ENE8VcQop70sT/seF6opt9acG3ko HzGCCDMqNiUfmUZdY4h5Ts/NkNGiQX/QxqAfE/hDFa3JVFwboXLH9WK9b42QlwKD4i VspIWHE6jcqcr17vm0A/gTXTL87MQYb/DAr/jk9EKfBuZDAAVZIYi7Ibo2mGmUfLfe TuzRkxf/cy1hA==
Am Sun, 24 Apr 2022 17:58:19 +0200
schrieb Christian Zietz <czietz@xxxxxxx>:
> today, I encountered a deadlock while running Hatari attached to a
> (real) serial port. This is on Linux, Debian 10, on a Raspberry Pi 400.
[...]
> At least with the C library used on my system fclose() blocks until any
> pending reads return. As a proof: If I force the device on the serial
> port to transmit some characters, the deadlock is broken and Hatari
> terminates.
>
> I therefore suggest either kill the RS232 thread or use non-blocking
> reads to that it can be terminated cleanly before calling fclose().
Hi Christian,
now that's quite unfortunate ... There used to be a SDL_KillThread()
function in SDL 1.2, which we also used in older versions of Hatari (see
commit 90382329895415c952), but it has been dropped in SDL 2, so there is
no way of killing the rs232 thread anymore... No clue how to get that
thread out of the blocked read now.
Non-blocking reads would be way easier, of course - but that does not work
on Windows AFAIK. We could maybe scratch that since hardly anybody likely
uses RS232 on Windows anyway?
Otherwise, I've got no idea how to fix that situation :-(
Thomas