cleanup createMutex

This commit is contained in:
georgemoralis 2023-11-12 20:23:42 +02:00
parent 8f8f0757af
commit f3c189feb3
1 changed files with 11 additions and 11 deletions

View File

@ -123,6 +123,17 @@ int PS4_SYSV_ABI scePthreadAttrSetschedpolicy(ScePthreadAttr* attr, int policy)
/**** /****
* Mutex calls * Mutex calls
*/ */
void* createMutex(void* addr) {
if (addr == nullptr || *static_cast<ScePthreadMutex*>(addr) != nullptr) {
return addr;
}
auto vaddr = reinterpret_cast<u64>(addr);
std::string name = fmt::format("mutex{:#x}", vaddr);
scePthreadMutexInit(static_cast<ScePthreadMutex*>(addr), nullptr, name.c_str());
return addr;
}
int PS4_SYSV_ABI scePthreadMutexInit(ScePthreadMutex* mutex, const ScePthreadMutexattr* attr, const char* name) { int PS4_SYSV_ABI scePthreadMutexInit(ScePthreadMutex* mutex, const ScePthreadMutexattr* attr, const char* name) {
PRINT_FUNCTION_NAME(); PRINT_FUNCTION_NAME();
if (mutex == nullptr) { if (mutex == nullptr) {
@ -154,17 +165,6 @@ int PS4_SYSV_ABI scePthreadMutexInit(ScePthreadMutex* mutex, const ScePthreadMut
} }
} }
void* createMutex(void* addr) {
if (addr == nullptr || *static_cast<void**>(addr) != nullptr) {
return addr;
}
auto vaddr = reinterpret_cast<u64>(addr);
std::string name = fmt::format("mutex{:#}", vaddr);
scePthreadMutexInit(static_cast<ScePthreadMutex*>(addr), nullptr, name.c_str());
return addr;
}
int PS4_SYSV_ABI scePthreadMutexattrInit(ScePthreadMutexattr* attr) { int PS4_SYSV_ABI scePthreadMutexattrInit(ScePthreadMutexattr* attr) {
*attr = new PthreadMutexattrInternal{}; *attr = new PthreadMutexattrInternal{};