From 5fab107fd32b656b8022a223c504cf0d76a58515 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 20 Oct 2021 09:24:45 +0200 Subject: [PATCH] lib/nfs/FileReader: use the thread-safe InjectEvent .. instead of DeferEvent, which is not thread-safe. This caused various playback problems, which was initially caused by the DeferEvent/InjectEvent split in commit 774b4313f2acf Closes https://github.com/MusicPlayerDaemon/MPD/issues/1298 --- NEWS | 2 ++ src/lib/nfs/FileReader.hxx | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index e071cfa97..3712f6fed 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.23.2 (not yet released) +* input + - nfs: fix playback bug * output - pipewire: send artist and title to PipeWire * neighbor diff --git a/src/lib/nfs/FileReader.hxx b/src/lib/nfs/FileReader.hxx index 5869eb2c6..8d257efdd 100644 --- a/src/lib/nfs/FileReader.hxx +++ b/src/lib/nfs/FileReader.hxx @@ -22,7 +22,7 @@ #include "Lease.hxx" #include "Callback.hxx" -#include "event/DeferEvent.hxx" +#include "event/InjectEvent.hxx" #include "util/Compiler.h" #include @@ -63,7 +63,10 @@ class NfsFileReader : NfsLease, NfsCallback { nfsfh *fh; - DeferEvent defer_open; + /** + * To inject the Open() call into the I/O thread. + */ + InjectEvent defer_open; public: NfsFileReader() noexcept; @@ -150,7 +153,7 @@ private: void OnNfsCallback(unsigned status, void *data) noexcept final; void OnNfsError(std::exception_ptr &&e) noexcept final; - /* DeferEvent callback */ + /* InjectEvent callback */ void OnDeferredOpen() noexcept; };