2023-07-17 22:46:25 +02:00
|
|
|
#pragma once
|
2023-07-20 11:18:43 +02:00
|
|
|
#define _TIMESPEC_DEFINED
|
|
|
|
|
2023-07-18 17:54:46 +02:00
|
|
|
#include <pthread.h>
|
|
|
|
#include <sched.h>
|
2023-11-05 12:41:10 +01:00
|
|
|
#include "common/types.h"
|
2023-07-20 10:20:11 +02:00
|
|
|
#include <string>
|
2023-07-18 17:54:46 +02:00
|
|
|
|
2023-07-17 22:46:25 +02:00
|
|
|
namespace HLE::Libs::LibKernel::ThreadManagement {
|
|
|
|
|
2023-07-18 17:54:46 +02:00
|
|
|
struct PthreadAttrInternal;
|
|
|
|
|
2023-07-18 18:28:28 +02:00
|
|
|
using SceKernelSchedParam = ::sched_param;
|
2023-07-18 17:54:46 +02:00
|
|
|
using ScePthreadAttr = PthreadAttrInternal*;
|
|
|
|
|
|
|
|
struct PthreadInternal {
|
2023-07-20 10:20:11 +02:00
|
|
|
u08 reserved[4096];
|
|
|
|
std::string name;
|
|
|
|
pthread_t pth;
|
|
|
|
ScePthreadAttr attr;
|
2023-07-18 17:54:46 +02:00
|
|
|
};
|
|
|
|
struct PthreadAttrInternal {
|
2023-07-20 10:20:11 +02:00
|
|
|
u08 reserved[64];
|
2023-07-18 17:54:46 +02:00
|
|
|
u64 affinity;
|
|
|
|
size_t guard_size;
|
|
|
|
int policy;
|
|
|
|
bool detached;
|
2023-07-20 10:20:11 +02:00
|
|
|
pthread_attr_t pth_attr;
|
2023-07-18 17:54:46 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class PThreadCxt {};
|
|
|
|
|
2023-07-20 11:18:43 +02:00
|
|
|
void Pthread_Init_Self_MainThread();
|
|
|
|
|
|
|
|
//HLE FUNCTIONS
|
2023-07-18 17:54:46 +02:00
|
|
|
int scePthreadAttrInit(ScePthreadAttr* attr);
|
|
|
|
int scePthreadAttrSetdetachstate(ScePthreadAttr* attr, int detachstate);
|
|
|
|
int scePthreadAttrSetinheritsched(ScePthreadAttr* attr, int inheritSched);
|
|
|
|
int scePthreadAttrSetschedparam(ScePthreadAttr* attr, const SceKernelSchedParam* param);
|
|
|
|
int scePthreadAttrSetschedpolicy(ScePthreadAttr* attr, int policy);
|
|
|
|
|
|
|
|
} // namespace HLE::Libs::LibKernel::ThreadManagement
|