initial ScePthreadCond works

This commit is contained in:
georgemoralis 2023-11-16 09:14:10 +02:00
parent 776a680e85
commit 1316443c59
1 changed files with 19 additions and 1 deletions

View File

@ -14,16 +14,20 @@ class SymbolsResolver;
namespace Core::Libraries::LibKernel { namespace Core::Libraries::LibKernel {
struct PthreadInternal;
struct PthreadAttrInternal; struct PthreadAttrInternal;
struct PthreadMutexInternal; struct PthreadMutexInternal;
struct PthreadMutexattrInternal; struct PthreadMutexattrInternal;
struct PthreadInternal; struct PthreadCondInternal;
struct PthreadCondAttrInternal;
using SceKernelSchedParam = ::sched_param; using SceKernelSchedParam = ::sched_param;
using ScePthread = PthreadInternal*; using ScePthread = PthreadInternal*;
using ScePthreadAttr = PthreadAttrInternal*; using ScePthreadAttr = PthreadAttrInternal*;
using ScePthreadMutex = PthreadMutexInternal*; using ScePthreadMutex = PthreadMutexInternal*;
using ScePthreadMutexattr = PthreadMutexattrInternal*; using ScePthreadMutexattr = PthreadMutexattrInternal*;
using ScePthreadCond = PthreadCondInternal*;
using ScePthreadCondattr = PthreadCondAttrInternal*;
using pthreadEntryFunc = PS4_SYSV_ABI void* (*)(void*); using pthreadEntryFunc = PS4_SYSV_ABI void* (*)(void*);
@ -55,13 +59,27 @@ struct PthreadMutexattrInternal {
int pprotocol; int pprotocol;
}; };
struct PthreadCondInternal {
u08 reserved[256];
std::string name;
pthread_cond_t cond;
};
struct PthreadCondAttrInternal {
u08 reserved[64];
pthread_condattr_t cond_attr;
};
class PThreadCxt { class PThreadCxt {
public: public:
ScePthreadMutexattr* getDefaultMutexattr() { return &m_default_mutexattr; } ScePthreadMutexattr* getDefaultMutexattr() { return &m_default_mutexattr; }
void setDefaultMutexattr(ScePthreadMutexattr attr) { m_default_mutexattr = attr; } void setDefaultMutexattr(ScePthreadMutexattr attr) { m_default_mutexattr = attr; }
ScePthreadCondattr* getDefaultCondattr() { return &m_default_condattr; }
void setDefaultCondattr(ScePthreadCondattr attr) { m_default_condattr = attr; }
private: private:
ScePthreadMutexattr m_default_mutexattr = nullptr; ScePthreadMutexattr m_default_mutexattr = nullptr;
ScePthreadCondattr m_default_condattr = nullptr;
}; };
void init_pthreads(); void init_pthreads();