MCPcopy Create free account
hub / github.com/Simple-XX/SimpleKernel / contention_worker

Function contention_worker

tests/system_test/mutex_test.cpp:157–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155};
156
157void contention_worker(void* arg) {
158 auto* ctx = reinterpret_cast<ContentionArgs*>(arg);
159 for (int i = 0; i < 5; ++i) {
160 (void)ctx->mtx->Lock();
161 int val = ctx->counter->load();
162 (void)sys_sleep(10);
163 ctx->counter->store(val + 1);
164 (void)ctx->mtx->UnLock();
165 }
166 sys_exit(0);
167}
168
169void test_mutex_contention(void* /*arg*/) {
170 klog::Info("=== Mutex Contention Test ===");

Callers

nothing calls this directly

Calls 4

sys_sleepFunction · 0.85
sys_exitFunction · 0.85
LockMethod · 0.45
UnLockMethod · 0.45

Tested by

no test coverage detected