Skip to content

Commit 4bcf835

Browse files
committed
add pthread_mutexattr_setrobust_np
1 parent c63a294 commit 4bcf835

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/lock/Mutex.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ int swMutex_create(swLock *lock, int use_in_process)
3030
if (use_in_process == 1)
3131
{
3232
pthread_mutexattr_setpshared(&lock->object.mutex.attr, PTHREAD_PROCESS_SHARED);
33+
pthread_mutexattr_setrobust_np(&lock->object.mutex.attr, PTHREAD_MUTEX_ROBUST_NP);
3334
}
3435
if ((ret = pthread_mutex_init(&lock->object.mutex._lock, &lock->object.mutex.attr)) < 0)
3536
{
@@ -95,5 +96,6 @@ int swMutex_lockwait(swLock *lock, int timeout_msec)
9596

9697
static int swMutex_free(swLock *lock)
9798
{
99+
pthread_mutexattr_destroy(&lock->object.mutex.attr);
98100
return pthread_mutex_destroy(&lock->object.mutex._lock);
99101
}

0 commit comments

Comments
 (0)