| 63 | void lv2_cond::save(utils::serial &ar) { ar(key, name, mtx_id); } |
| 64 | |
| 65 | error_code sys_cond_create(ppu_thread &ppu, vm::ptr<u32> cond_id, u32 mutex_id, |
| 66 | vm::ptr<sys_cond_attribute_t> attr) { |
| 67 | ppu.state += cpu_flag::wait; |
| 68 | |
| 69 | sys_cond.trace("sys_cond_create(cond_id=*0x%x, mutex_id=0x%x, attr=*0x%x)", |
| 70 | cond_id, mutex_id, attr); |
| 71 | |
| 72 | auto mutex = idm::get_unlocked<lv2_obj, lv2_mutex>(mutex_id); |
| 73 | |
| 74 | if (!mutex) { |
| 75 | return CELL_ESRCH; |
| 76 | } |
| 77 | |
| 78 | const auto _attr = *attr; |
| 79 | |
| 80 | const u64 ipc_key = lv2_obj::get_key(_attr); |
| 81 | |
| 82 | if (ipc_key) { |
| 83 | sys_cond.warning("sys_cond_create(cond_id=*0x%x, attr=*0x%x): IPC=0x%016x", |
| 84 | cond_id, attr, ipc_key); |
| 85 | } |
| 86 | |
| 87 | if (const auto error = |
| 88 | lv2_obj::create<lv2_cond>(_attr.pshared, ipc_key, _attr.flags, [&] { |
| 89 | return make_single<lv2_cond>(ipc_key, _attr.name_u64, mutex_id, |
| 90 | std::move(mutex)); |
| 91 | })) { |
| 92 | return error; |
| 93 | } |
| 94 | |
| 95 | ppu.check_state(); |
| 96 | *cond_id = idm::last_id(); |
| 97 | return CELL_OK; |
| 98 | } |
| 99 | |
| 100 | error_code sys_cond_destroy(ppu_thread &ppu, u32 cond_id) { |
| 101 | ppu.state += cpu_flag::wait; |
no test coverage detected