Quantcast
Channel: naudio Work Item Rss Feed
Viewing all articles
Browse latest Browse all 738

Edited Issue: WasapiCapture class - deadlock in StopRecording() [16128]

$
0
0
Deadlock has place in StopRecording() in WasapiCapture class in the implementation presented in WavRecording demo code.
When Stop button is pressed then StopRecording() is launched. Flag stop is set to true.
StopRecording calls waits for thread "captureThread.Join();".
When recording thread detects stop flag, then it calls Dispose().
Dispose() calls again StopRecording(), but we already were here and we are waiting for thread. So thread.Join is called for the second time, and we have deadlock problem.
I avoided this problem with extending condition in StopRecording():
if (this.captureThread != null && this.stop == false)
instead of
if (this.captureThread != null)

Regards.
Piotr.

Viewing all articles
Browse latest Browse all 738

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>