Update StarThread_unix.cpp
This commit is contained in:
parent
cadd5b32ff
commit
10c4cff2ed
@ -131,8 +131,14 @@ struct MutexImpl {
|
||||
}
|
||||
|
||||
void lock() {
|
||||
timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
ts.tv_sec += 60;
|
||||
if (pthread_mutex_timedlock(&mutex, &ts) != 0) {
|
||||
Logger::warn("Mutex lock is taking too long. Stack:\n{}", outputStack(captureStack());
|
||||
pthread_mutex_lock(&mutex);
|
||||
}
|
||||
}
|
||||
|
||||
void unlock() {
|
||||
pthread_mutex_unlock(&mutex);
|
||||
@ -199,8 +205,14 @@ struct RecursiveMutexImpl {
|
||||
}
|
||||
|
||||
void lock() {
|
||||
timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
ts.tv_sec += 60;
|
||||
if (pthread_mutex_timedlock(&mutex, &ts) != 0) {
|
||||
Logger::warn("RecursiveMutex lock is taking too long. Stack:\n{}", outputStack(captureStack());
|
||||
pthread_mutex_lock(&mutex);
|
||||
}
|
||||
}
|
||||
|
||||
void unlock() {
|
||||
pthread_mutex_unlock(&mutex);
|
||||
|
Loading…
Reference in New Issue
Block a user