Update StarThread_unix.cpp

This commit is contained in:
Kae 2024-08-14 13:30:44 +10:00
parent 10c4cff2ed
commit 86a1de4fbd

View File

@ -135,7 +135,8 @@ struct MutexImpl {
clock_gettime(CLOCK_REALTIME, &ts); clock_gettime(CLOCK_REALTIME, &ts);
ts.tv_sec += 60; ts.tv_sec += 60;
if (pthread_mutex_timedlock(&mutex, &ts) != 0) { if (pthread_mutex_timedlock(&mutex, &ts) != 0) {
Logger::warn("Mutex lock is taking too long. Stack:\n{}", outputStack(captureStack()); Logger::warn("Mutex lock is taking too long, printing stack");
printStack();
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
} }
} }
@ -209,7 +210,8 @@ struct RecursiveMutexImpl {
clock_gettime(CLOCK_REALTIME, &ts); clock_gettime(CLOCK_REALTIME, &ts);
ts.tv_sec += 60; ts.tv_sec += 60;
if (pthread_mutex_timedlock(&mutex, &ts) != 0) { if (pthread_mutex_timedlock(&mutex, &ts) != 0) {
Logger::warn("RecursiveMutex lock is taking too long. Stack:\n{}", outputStack(captureStack()); Logger::warn("RecursiveMutex lock is taking too long, printing stack");
printStack();
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
} }
} }