[threading linux] Implement suspend count

Add suspend count to thread implementation.
Increment suspend count on suspend and decrement on resume.
Wait on suspend count to be decremented to 0.
Return suspend count on suspend and on resume before incr/decr.
Fix naming of resume suspend count to make clear that suspend count is
before incr/decr.
Add test.
This commit is contained in:
Sandy Carter
2019-07-13 16:18:49 -04:00
committed by Rick Gibbed
parent 382dd8860f
commit e945a13957
4 changed files with 68 additions and 18 deletions

View File

@@ -389,7 +389,7 @@ class Thread : public WaitHandle {
// Decrements a thread's suspend count. When the suspend count is decremented
// to zero, the execution of the thread is resumed.
virtual bool Resume(uint32_t* out_new_suspend_count = nullptr) = 0;
virtual bool Resume(uint32_t* out_previous_suspend_count = nullptr) = 0;
// Suspends the specified thread.
virtual bool Suspend(uint32_t* out_previous_suspend_count = nullptr) = 0;