PDA

Click to See Complete Forum and Search --> : [RESOLVED]Need help delaying code execution


nci
Oct 26th, 2007, 06:36 PM
hello, i was wondering...
how do i suspend code execution for a few milliseconds when using a backgroundworker?

private void Core_DoWork(object sender, DoWorkEventArgs e)
{
uint iTime=0;
int iLoop = 0;

while (iLoop == 0)
{
if (FMODSound != null)
{
FMODChannel.getPosition(ref iTime, FMOD.TIMEUNIT.MS);
SetTime((int)iTime / 1000);
}

//need something to suspend the code for a bout 500ms
//{EDIT}
//I had to manually put using System.Threading; and make a call
//to:
System.Threading.Thread.Sleep(500);

}
}


thanks for any help


nevermind, i figured it out, thanks tho

Hack
Oct 30th, 2007, 07:51 AM
nevermind, i figured it out, thanks thoPlease post your resolution as it might help someone else with the same question.

Thanks.

nci
Oct 30th, 2007, 09:34 AM
oh, sorry, i used the edit and added it in my original post, but here it is

//need something to suspend the code for a bout 500ms
//{EDIT}
//I had to manually put using System.Threading; and make a call
//to:
System.Threading.Thread.Sleep(500);



i just had to add using System.Threading and call
System.Threading.Thread.Sleep(500);