From b5d5c1e2e6eed84babb0064d131368e6e1f33819 Mon Sep 17 00:00:00 2001 From: deischen Date: Thu, 8 Jan 2004 15:37:09 +0000 Subject: Add a simple work-around for deadlocking on recursive read locks on a rwlock while there are writers waiting. We normally favor writers but when a reader already has at least one other read lock, we favor the reader. We don't track all the rwlocks owned by a thread, nor all the threads that own a rwlock -- we just keep a count of all the read locks owned by a thread. PR: 24641 --- lib/libpthread/thread/thr_create.c | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/libpthread/thread/thr_create.c') diff --git a/lib/libpthread/thread/thr_create.c b/lib/libpthread/thread/thr_create.c index b82f1809..38c2fc4 100644 --- a/lib/libpthread/thread/thr_create.c +++ b/lib/libpthread/thread/thr_create.c @@ -252,6 +252,7 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr, sigemptyset(&new_thread->sigpend); new_thread->check_pending = 0; new_thread->locklevel = 0; + new_thread->rdlock_count = 0; new_thread->sigstk.ss_sp = 0; new_thread->sigstk.ss_size = 0; new_thread->sigstk.ss_flags = SS_DISABLE; -- cgit v1.1