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 774b4313f2
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1298
			
			
This commit is contained in:
		
							
								
								
									
										2
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								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
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,7 @@
 | 
			
		||||
 | 
			
		||||
#include "Lease.hxx"
 | 
			
		||||
#include "Callback.hxx"
 | 
			
		||||
#include "event/DeferEvent.hxx"
 | 
			
		||||
#include "event/InjectEvent.hxx"
 | 
			
		||||
#include "util/Compiler.h"
 | 
			
		||||
 | 
			
		||||
#include <cstddef>
 | 
			
		||||
@@ -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;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user