Skip to contentSkip to conversation

posix: fix pthread_mutex_timedlock for recursive mutexes.

PATCH Applied Jeffrey Melville 2 participants 3 messages Apr 12, 2016 – Apr 14, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 posix: fix pthread_mutex_timedlock for recursive mutexes.

Fix erroneous returns of -EBUSY when calling pthread_mutex_timedlock on a recursive mutex already locked by the calling thread.

---
 src/skins/posix/mutex.c | 1 +
 1 file changed, 1 insertion(+)
src/skins/posix/mutex.c +1 -0
index 0cf2d8b..0323fe0 100644
@@ -265,6 +265,7 @@ int __wrap_pthread_mutex_timedlock(pthread_mutex_t *mutex,
 			}
 
 			++shadow->lockcnt;
+			err = 0;
 			goto out;
 		}
 
Signature · 1 line
1.9.1
#1 lore raw
Quoted 14 lines · Jeffrey Melville

Fix erroneous returns of -EBUSY when calling pthread_mutex_timedlock on a recursive mutex already locked by the calling thread.

---
 src/skins/posix/mutex.c | 1 +
 1 file changed, 1 insertion(+)
src/skins/posix/mutex.c +0 -0
index 0cf2d8b..0323fe0 100644

src/skins/posix/mutex.c int __wrap_pthread_mutex_timedlock(pthread_mutex_t *mutex, · line 271

Quoted 7 lines
src/skins/posix/mutex.c +1 -0
@@ -265,6 +265,7 @@ int __wrap_pthread_mutex_timedlock(pthread_mutex_t *mutex,
 			}
 
 			++shadow->lockcnt;
+			err = 0;
 			goto out;
 		}
 

Good catch, thanks. Fortunately this does not affect 3.x.

Signature · 1 line
Philippe.
#2 lore raw
In reply to Jeffrey Melville
Quoted 14 lines · Jeffrey Melville

Fix erroneous returns of -EBUSY when calling pthread_mutex_timedlock on a recursive mutex already locked by the calling thread.

---
 src/skins/posix/mutex.c | 1 +
 1 file changed, 1 insertion(+)
src/skins/posix/mutex.c +0 -0
index 0cf2d8b..0323fe0 100644

src/skins/posix/mutex.c int __wrap_pthread_mutex_timedlock(pthread_mutex_t *mutex, · line 271

Quoted 7 lines
src/skins/posix/mutex.c +1 -0
@@ -265,6 +265,7 @@ int __wrap_pthread_mutex_timedlock(pthread_mutex_t *mutex,
 			}
 
 			++shadow->lockcnt;
+			err = 0;
 			goto out;
 		}
 

Merged, thanks.

Signature · 1 line
Philippe.