|
-
June 4th, 2011, 06:44 AM
#1
Locking a thread when is not needed and resume it when is needed.
hello i want to pause a thread when is not needed and resume it when i need it latter.
I tried using SuspendThread and ResumeThread but it behaves bugy when try to suspend and resume quickly, i been told that is not a good practice to use those functions if im not developing a debugger.
im not trying to sincronize multiple threads i dont have troubles with that critical sections and mutex works just fine.
i want to lock the thread so i could save system resources and resume when i need it.
i been trying to use WaitForSingleObject but it "Locks" only when another thread obtains the mutex but i want to be able to lock the thread form it self.
something like
while(Lock==true){
Sleep(50);
}
if i set the Lock to false from another thread this thread would resume. and pick another job.
am i able to get this functionality by using WaitForSingleObject?
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
|