| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkSemaphore_DEFINED | 8 #ifndef SkSemaphore_DEFINED |
| 9 #define SkSemaphore_DEFINED | 9 #define SkSemaphore_DEFINED |
| 10 | 10 |
| 11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
| 12 #include "SkAtomics.h" | 12 #include "../private/SkAtomics.h" |
| 13 #include "../private/SkOncePtr.h" | 13 #include "../private/SkOncePtr.h" |
| 14 | 14 |
| 15 struct SkBaseSemaphore { | 15 struct SkBaseSemaphore { |
| 16 | 16 |
| 17 // Increment the counter by 1. | 17 // Increment the counter by 1. |
| 18 // This is a specialization for supporting SkMutex. | 18 // This is a specialization for supporting SkMutex. |
| 19 void signal() { | 19 void signal() { |
| 20 // Since this fetches the value before the add, 0 indicates that this th
read is running and | 20 // Since this fetches the value before the add, 0 indicates that this th
read is running and |
| 21 // no threads are waiting, -1 and below means that threads are waiting,
but only signal 1 | 21 // no threads are waiting, -1 and below means that threads are waiting,
but only signal 1 |
| 22 // thread to run. | 22 // thread to run. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 void wait(); | 78 void wait(); |
| 79 | 79 |
| 80 void signal(int n = 1); | 80 void signal(int n = 1); |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 SkBaseSemaphore fBaseSemaphore; | 83 SkBaseSemaphore fBaseSemaphore; |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 #endif//SkSemaphore_DEFINED | 86 #endif//SkSemaphore_DEFINED |
| OLD | NEW |