| 64 | } |
| 65 | |
| 66 | void RunRecursiveMutex() { |
| 67 | for (size_t i = 0; i < Id_ + 1; ++i) { |
| 68 | Data_.mutex.Acquire(); |
| 69 | ++Data_.sharedCounter; |
| 70 | usleep(1); |
| 71 | } |
| 72 | FAIL_ASSERT(Data_.sharedCounter == Id_ + 1); |
| 73 | |
| 74 | bool res = Data_.mutex.TryAcquire(); |
| 75 | FAIL_ASSERT(res); |
| 76 | Data_.mutex.Release(); |
| 77 | |
| 78 | for (size_t i = 0; i < Id_; ++i) { |
| 79 | --Data_.sharedCounter; |
| 80 | Data_.mutex.Release(); |
| 81 | } |
| 82 | FAIL_ASSERT(Data_.sharedCounter == 1); |
| 83 | --Data_.sharedCounter; |
| 84 | Data_.mutex.Release(); |
| 85 | } |
| 86 | |
| 87 | #undef FAIL_ASSERT |
| 88 |
nothing calls this directly
no test coverage detected