[pbs-devel] [RFC PATCH proxmox 1/4] proxmox-async: add SenderWriter helper

Wolfgang Bumiller w.bumiller at proxmox.com
Fri Feb 18 16:27:55 CET 2022


On Fri, Feb 18, 2022 at 08:36:05AM +0100, Dietmar Maurer wrote:
> This can block the executor? If so, should we use block_in_place?
> Or does self.sender.blocking_send() consider that automatically?

The sender in this case is a thread. The tokio side is the receiver.

The type implements `Write` which is blocking by definition, adding a
`block_in_place` inside it is never correct.

If mixing of blocking/async code is really a concern (which I don't
think it is), I'd rather not expose `from_sender` (or under a different
name as an `unsafe fn`) and instead only have a function creating the
*tuple* of `(SenderWriter, Receiver)` with appropriate documentation
about the sync/async nature of the two sides.

But I don't think this is truly warranted.





More information about the pbs-devel mailing list