rpcsx/rpcs3/Emu/Cell/lv2/sys_cond.h

45 lines
825 B
C
Raw Normal View History

2014-02-13 17:59:13 +01:00
#pragma once
2016-04-14 00:23:53 +02:00
#include "sys_sync.h"
struct lv2_mutex_t;
2015-03-06 23:10:04 +01:00
struct sys_cond_attribute_t
2014-02-13 17:59:13 +01:00
{
be_t<u32> pshared;
be_t<s32> flags;
2015-03-06 23:10:04 +01:00
be_t<u64> ipc_key;
2014-02-13 17:59:13 +01:00
union
{
char name[8];
u64 name_u64;
};
};
struct lv2_cond_t
2014-02-13 17:59:13 +01:00
{
2015-03-06 23:10:04 +01:00
const u64 name;
const std::shared_ptr<lv2_mutex_t> mutex; // associated mutex
2015-03-06 23:10:04 +01:00
2016-04-14 00:23:53 +02:00
sleep_queue<cpu_thread> sq;
2015-03-10 15:42:08 +01:00
lv2_cond_t(const std::shared_ptr<lv2_mutex_t>& mutex, u64 name)
: mutex(mutex)
2015-03-06 23:10:04 +01:00
, name(name)
2014-02-13 17:59:13 +01:00
{
}
2015-07-19 03:56:33 +02:00
2016-04-14 00:23:53 +02:00
void notify(lv2_lock_t, cpu_thread* thread);
};
2014-12-23 00:31:11 +01:00
class PPUThread;
// SysCalls
s32 sys_cond_create(vm::ptr<u32> cond_id, u32 mutex_id, vm::ptr<sys_cond_attribute_t> attr);
s32 sys_cond_destroy(u32 cond_id);
s32 sys_cond_wait(PPUThread& ppu, u32 cond_id, u64 timeout);
s32 sys_cond_signal(u32 cond_id);
s32 sys_cond_signal_all(u32 cond_id);
s32 sys_cond_signal_to(u32 cond_id, u32 thread_id);