|
-
February 27th, 2004, 02:47 PM
#1
Sleeping threads
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
-
February 27th, 2004, 03:54 PM
#2
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.
Good luck
-
February 27th, 2004, 04:29 PM
#3
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|