// JP opened flex table

Click to See Complete Forum and Search --> : Sleeping threads


Gyannea
February 27th, 2004, 02:47 PM
Is there a conflict calling SuspendThread() or ResumeThread() if the thread being played with calls the Sleep() function?

I have a thread which scans a radio. All it does at this stage is color an indicator lamp in a window and Sleep 'x' milliseconds before erasing the current lamp and coloring a new one. The process repeats in an infinite "while(1)" loop.

IN another thread if a signal from the radio is found SuspendThread() is called to stop scanning. Depending upon what happens, ResumeThread() may be called to restart the scan. The thread that calls the Resume and Suspend functions occassionally locks up, even though the scanner keeps going. However, taking these lines out stops the lockup.

Neither of these threads involves a window...I think. The thread doing the Suspending/Resuming does involve DirectSound and DirectSoundCapture, but I don't see how any Windows messaging is involved.

Does anyone understand this mess?

Thanks,

Brian

Caprice
February 27th, 2004, 03:54 PM
Perhaps, I don't know how to use such functions correctly. So I prefer to use events when I need to suspend a thread. The thread is a loop with WaitForMultipleObjects.

Andreas Masur
February 27th, 2004, 04:29 PM
[Moved thread]

//JP added flex table