Tuesday, 15 September 2015

c++ - Windows thread sleep and wake from another thread -



c++ - Windows thread sleep and wake from another thread -

i have thread running in class send sleep , wake when thread wakes up, without passing mutex or element around if possible, it's self contained.

basically, have tried approach of mutex in thread calls waitforsingleobject twice, expecting create mutex non signaling first call, each time functions homecoming 0 because mutex signaled , thread mutex owner , remains owner. expected 1 time asleep, class method called release mutex, example.

is there easy approach in windows or forced break encapsulation? run

although waitable handle approach favoured way approach task, can utilize suspendthread / resumethread you're trying without using waitforsingleobject / waitformultipleobjects.

both functions take handle thread want sleep or wake.

c++ windows multithreading

No comments:

Post a Comment