C# Thread Queue Synchronize

Posted by ikurtz on Stack Overflow See other posts from Stack Overflow or by ikurtz
Published on 2010-03-28T15:39:09Z Indexed on 2010/03/28 15:43 UTC
Read the original article Hit count: 313

Filed under:
|
|

Greetings, I am trying to play some audio files without holding up the GUI. Below is a sample of the code:

if (audio)
{
    if (ThreadPool.QueueUserWorkItem(new WaitCallback(CoordinateProc), fireResult))
    {

    }
    else
    {
        MessageBox.Show("false");
    }
}

if (audio)
{
    if (ThreadPool.QueueUserWorkItem(new WaitCallback(FireProc), fireResult))
    {

    }
    else
    {
         MessageBox.Show("false");
    }
}

if (audio)
{
    if (ThreadPool.QueueUserWorkItem(new WaitCallback(HitProc), fireResult))
    {

    }
    else
    {
        MessageBox.Show("false");
    }
}

The situation is the samples are not being played in order. some play before the other and I need to fix this so the samples are played one after another in order.

How do I implement this please?

Thank you.

© Stack Overflow or respective owner

Related posts about c#

Related posts about threadpool