MCPcopy Create free account
hub / github.com/catboost/catboost / RunRecursiveMutex

Method RunRecursiveMutex

util/system/mutex_ut.cpp:66–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

usleepFunction · 0.85
AcquireMethod · 0.45
TryAcquireMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected