C# ThreadPool QueueUserWorkItem Synchronization
Posted
by ikurtz
on Stack Overflow
See other posts from Stack Overflow
or by ikurtz
Published on 2010-03-28T18:17:53Z
Indexed on
2010/03/28
18:23 UTC
Read the original article
Hit count: 1576
Greetings, I am employing ThreadPool.QueueUserWorkItem to play some sound files and not hanging up the GUI while doing so.
It is working but has an undesirable side effect.
While the QueueUserWorkItem CallBack Proc is being executed there is nothing to stop it from starting a new thread. This causes the samples in the threads to overlap.
How can I make it so that it waits for the already running thread to finish running and only then run the next request?
Thanks in advance :)
© Stack Overflow or respective owner