Fixed
Created: Jun 5, 2017
Updated: Jul 10, 2019
Resolved Date: Jun 15, 2017
Found In Version: 8.0.0.15
Fix Version: 8.0.0.19
Severity: Standard
Applicable for: Wind River Linux 8
Component/s: Kernel
I see different behavior on ARM vs Intel when calling pthread_mutex_timedlock() on a robust mutex on ARM vs. Intel. The attached code snippet works fine on Intel, but not on ARM (32-bit, or 32/64-bit).
If I take out this call it works on ARM too: pthread_mutexattr_setrobust(&mattrs, PTHREAD_MUTEX_ROBUST);
Unfortunately there is no Linux man page on pthread_mutex_timedlock() so I have to refer to this one:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_timedlock.html
pthread_mutex_timedlock - lock a mutex - JOSSO 2
pubs.opengroup.org
NAME pthread_mutex_timedlock - lock a mutex SYNOPSIS. #include #include int pthread_mutex_timedlock(pthread_mutex_t *restrict mutex,
It mentions robust mutexes, but not in regards to whether they are supported or not for this specific API.
The expected output which I get on Intel is:
[20413] (1495032822 201476652) waiting for critical section
[20413] (1495032822 201488415) ret 0 [Success]
[20412] (1495032823 201550931) waiting for critical section
[20412] (1495032823 201606217) ret 110 [Connection timed out] # returns immediately
[20413] (1495032827 201581952) exiting critical section
[20413] (1495032827 201589623) exiting
What I get on ARM is:
[2365] (946794333 160991750) waiting for critical section
[2365] (946794333 161031203) ret 0 [Success]
[2364] (946794334 161041882) waiting for critical section
[2365] (946794338 161101386) exiting critical section
[2365] (946794338 161110988) exiting
[2364] (946794338 161114328) ret 0 [Success]
[2364] (946794343 161181871) exiting critical section
[2364] (946794343 161186820) exiting
Essentially it looks like the mutex is not returning immediately as it should, instead it blocks until the other threads releases the lock.