greshake / i3status-rust

Very resourcefriendly and feature-rich replacement for i3status, written in pure Rust
GNU General Public License v3.0
2.81k stars 472 forks source link

pulseaudio,pipewire: use tokio::sync::Notify instead of channels, remove spinlock #2025

Closed MaxVerevkin closed 3 months ago

MaxVerevkin commented 3 months ago

By the way, is wait_until_ready (src/blocks/privacy/pipewire.rs:173) even necessary? If I comment out the line client.wait_until_ready().await; nothing bad happens.

bim9262 commented 3 months ago

By the way, is wait_until_ready (src/blocks/privacy/pipewire.rs:173) even necessary? If I comment out the line client.wait_until_ready().await; nothing bad happens.

This is there so that we don't spam that the block with updates as the nodes/links are loaded

MaxVerevkin commented 3 months ago

This is there so that we don't spam that the block with updates as the nodes/links are loaded

I tried to test it, and without wait_until_ready() the block is notified just once. This is probably not deterministic, and it could happen that it is notified multiple times.

I think this can be implemented using an idle callback, which is enabled only when something happens. Then blocks are notified from the that callback, which then disables itself (if that's possible). I try implementing this a bit later.