is it possible to use finite timeouts with chprintf()? I use this function to emit data to a serial line, which may asynchronously disconnect in the middle of the call, in which case my task hangs forever
It is not currently possible, it would require changes because chprintf() prints on a stream (BaseSequentialStream) and streams don't have timeouts.
You could consider the normal printf() and provide your output function with timeout, this is compiler-dependent however. I will look into changes for chprintf() but this could take a while.
Moving this topic under "change requests".
BTW, you could reset the serial driver output queue, it would be released.