MCPcopy Create free account
hub / github.com/RPCSX/rpcsx / sys_mutex_unlock

Function sys_mutex_unlock

kernel/cellos/src/sys_mutex.cpp:300–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298}
299
300error_code sys_mutex_unlock(ppu_thread &ppu, u32 mutex_id) {
301 ppu.state += cpu_flag::wait;
302
303 sys_mutex.trace("sys_mutex_unlock(mutex_id=0x%x)", mutex_id);
304
305 const auto mutex = idm::check<lv2_obj, lv2_mutex>(
306 mutex_id,
307 [&, notify = lv2_obj::notify_all_t()](lv2_mutex &mutex) -> CellError {
308 auto result = mutex.try_unlock(ppu);
309
310 if (result == CELL_EBUSY) {
311 std::lock_guard lock(mutex.mutex);
312
313 if (auto cpu = mutex.reown<ppu_thread>()) {
314 if (cpu->state & cpu_flag::again) {
315 ppu.state += cpu_flag::again;
316 return {};
317 }
318
319 mutex.awake(cpu);
320 }
321
322 result = {};
323 }
324
325 notify.cleanup();
326 return result;
327 });
328
329 if (!mutex) {
330 return CELL_ESRCH;
331 }
332
333 if (mutex.ret) {
334 return mutex.ret;
335 }
336
337 return CELL_OK;
338}

Callers 15

sys_ppu_thread_onceFunction · 0.85
sys_lwmutex_unlockFunction · 0.85
execMethod · 0.85
send_commandMethod · 0.85
execMethod · 0.85
send_commandMethod · 0.85
release_outputMethod · 0.85
link_frameMethod · 0.85

Calls 4

notify_all_tClass · 0.85
awakeMethod · 0.80
try_unlockMethod · 0.45
cleanupMethod · 0.45

Tested by

no test coverage detected