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

Commented Unassigned: Deadlock in Callback with WaveOut.GetPosition [16398]

$
0
0
I call WaveOut.GetPosition up to 60 times per second to sync an animation, and when using the Callback strategy, I get deadlocks very quickly (within 20-30 seconds) and consistently (all the time). I've [described the problem in more detail](http://stackoverflow.com/a/16468906/1174169) on Stack Overflow.

I made a change in WaveOut.Callback to delegate the work to the thread pool. I'm not sure if this is the best idea, as I'm not so familiar with the source of NAudio. Do you think this is a good idea? I've checked in the changes on [my NAudio fork](https://naudio.codeplex.com/SourceControl/network/forks/cod3monk3y/NAudio/changeset/1b3747e016b6).

I had to update the profile to 4.0 in order to use the `Task` class.

This solves the deadlock issue, and pretty much runs exactly the same way. The only difference (besides non deadlock) is that the thread running the callback isn't an OS thread. It's a thread pool thread.

Thanks!
/cm
Comments: cool. I checked the same change in too since I happened to have the project loaded up. Would have pulled from your fork if I'd realised, but thanks anyway

Viewing all articles
Browse latest Browse all 738

Trending Articles