mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 16:32:39 +00:00
mutex: Few misc fixes
This commit is contained in:
parent
856564759b
commit
2ef4012ec7
@ -121,6 +121,7 @@ int PthreadMutex::SelfTryLock() {
|
|||||||
switch (Type()) {
|
switch (Type()) {
|
||||||
case PthreadMutexType::ErrorCheck:
|
case PthreadMutexType::ErrorCheck:
|
||||||
case PthreadMutexType::Normal:
|
case PthreadMutexType::Normal:
|
||||||
|
case PthreadMutexType::AdaptiveNp:
|
||||||
return POSIX_EBUSY;
|
return POSIX_EBUSY;
|
||||||
case PthreadMutexType::Recursive: {
|
case PthreadMutexType::Recursive: {
|
||||||
/* Increment the lock count: */
|
/* Increment the lock count: */
|
||||||
@ -224,7 +225,7 @@ int PthreadMutex::Lock(const OrbisKernelTimespec* abstime, u64 usec) {
|
|||||||
[[unlikely]] {
|
[[unlikely]] {
|
||||||
ret = POSIX_EINVAL;
|
ret = POSIX_EINVAL;
|
||||||
} else {
|
} else {
|
||||||
if (THR_RELTIME) {
|
if (abstime == THR_RELTIME) {
|
||||||
ret = m_lock.try_lock_for(std::chrono::microseconds(usec)) ? 0 : POSIX_ETIMEDOUT;
|
ret = m_lock.try_lock_for(std::chrono::microseconds(usec)) ? 0 : POSIX_ETIMEDOUT;
|
||||||
} else {
|
} else {
|
||||||
ret = m_lock.try_lock_until(abstime->TimePoint()) ? 0 : POSIX_ETIMEDOUT;
|
ret = m_lock.try_lock_until(abstime->TimePoint()) ? 0 : POSIX_ETIMEDOUT;
|
||||||
@ -336,7 +337,7 @@ int PS4_SYSV_ABI posix_pthread_mutex_isowned_np(PthreadMutexT* mutex) {
|
|||||||
return m->m_owner == g_curthread;
|
return m->m_owner == g_curthread;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PthreadMutex::IsOwned(Pthread* curthread) const {
|
int PthreadMutex::IsOwned(Pthread* curthread) const {
|
||||||
if (this <= THR_MUTEX_DESTROYED) [[unlikely]] {
|
if (this <= THR_MUTEX_DESTROYED) [[unlikely]] {
|
||||||
if (this == THR_MUTEX_DESTROYED) {
|
if (this == THR_MUTEX_DESTROYED) {
|
||||||
return POSIX_EINVAL;
|
return POSIX_EINVAL;
|
||||||
|
@ -79,7 +79,7 @@ struct PthreadMutex {
|
|||||||
return Unlock();
|
return Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsOwned(Pthread* curthread) const;
|
int IsOwned(Pthread* curthread) const;
|
||||||
};
|
};
|
||||||
using PthreadMutexT = PthreadMutex*;
|
using PthreadMutexT = PthreadMutex*;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user