Fix SkSemaphore comments.

Change-Id: I14fc03fcb73bad61daed7c4cd3ed12bfae6b1217
Reviewed-on: https://skia-review.googlesource.com/8880
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Mike Klein 2017-02-22 14:33:12 -05:00 committed by Skia Commit-Bot
parent 91ad074312
commit 19eec39c90

View File

@ -22,7 +22,7 @@ public:
void signal(int n = 1);
// Decrement the counter by 1,
// then if the counter is <= 0, sleep this thread until the counter is > 0.
// then if the counter is < 0, sleep this thread until the counter is >= 0.
void wait();
// If the counter is positive, decrement it by 1 and return true, otherwise return false.
@ -40,7 +40,7 @@ private:
//
// We wrap an OS-provided semaphore with a user-space atomic counter that
// lets us avoid interacting with the OS semaphore unless strictly required:
// moving the count from >0 to <=0 or vice-versa, i.e. sleeping or waking threads.
// moving the count from >=0 to <0 or vice-versa, i.e. sleeping or waking threads.
struct OSSemaphore;
void osSignal(int n);
@ -61,7 +61,7 @@ inline void SkBaseSemaphore::signal(int n) {
int prev = fCount.fetch_add(n, std::memory_order_release);
// We only want to call the OS semaphore when our logical count crosses
// from <= 0 to >0 (when we need to wake sleeping threads).
// from <0 to >=0 (when we need to wake sleeping threads).
//
// This is easiest to think about with specific examples of prev and n.
// If n == 5 and prev == -3, there are 3 threads sleeping and we signal