summaryrefslogtreecommitdiffstats
path: root/linker
diff options
context:
space:
mode:
authorPavel Chupin <pavel.v.chupin@intel.com>2012-02-20 10:49:13 +0400
committerBruce Beare <bruce.j.beare@intel.com>2012-02-21 14:57:26 -0800
commite19d702b8e330cef87e0983733c427b5f7842144 (patch)
treef657d4a39b7e45d0603b30762f4496f947ec043e /linker
parenta60ff6c5b2ca76181b387d8c10aee22a2cbcf840 (diff)
downloadbionic-e19d702b8e330cef87e0983733c427b5f7842144.zip
bionic-e19d702b8e330cef87e0983733c427b5f7842144.tar.gz
bionic-e19d702b8e330cef87e0983733c427b5f7842144.tar.bz2
Redesign dlopen() locks to be recursive per thread.
That is to fix the bug: dlxxx functions can't be called recursively. For example, if we use dlopen() to use open one library whose constructor also calls dlopen() in order to open another library, then the thread is dead-blocked. By changing the dl_lock from a non-recursive lock to a recursive lock, we can prevent the thread from dead-blocked by recursive dlxxx calls in the same thread context. Change-Id: I1018b41c82f4641cc009c0a2eda31f5a47a534f9 Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com> Signed-off-by: Jack Ren <jack.ren@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Diffstat (limited to 'linker')
-rw-r--r--linker/dlfcn.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/linker/dlfcn.c b/linker/dlfcn.c
index 5964bd1..194a4ae 100644
--- a/linker/dlfcn.c
+++ b/linker/dlfcn.c
@@ -42,7 +42,7 @@ static const char *dl_errors[] = {
#define likely(expr) __builtin_expect (expr, 1)
#define unlikely(expr) __builtin_expect (expr, 0)
-static pthread_mutex_t dl_lock = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t dl_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER;
static void set_dlerror(int err)
{