[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Thread-safety "guidelines" of LTDL

From: Bob Friesenhahn
Subject: Re: Thread-safety "guidelines" of LTDL
Date: Wed, 11 Aug 2010 15:35:34 -0500 (CDT)
User-agent: Alpine 2.01 (GSO 1266 2009-07-14)

On Wed, 11 Aug 2010, Andreas Mohr wrote:


I've been reading "Using libltdl in a multi threaded environment" at

and I must say I feel that it's rather misguided.

I'm as threading-resistant as anyone *)
, but IMHO suggesting the use of ugly, contention-hampered,
__insufficient__ mutexes to make LTDL "thread-safe" in an external manner
is too short-sighted.

Assuming that we agree with most of your points, would it not be sufficient to implement libltdl as a singleton model where each "user" requests a handle, and accesses via this handle access a single actual instance of libltdl in a thread-safe (i.e. mutex protected) way? This approach seems to avoid needing to radically modify libltdl. This approach should also not hinder performance much since dlopen(), dlsym(), and friends already need to include locking in order to be thread safe.

As for myself, I am not at all "threading-resistant" and have yet to see the horrors occur which were forecast by others when I first started to use threading in 1996. There is no doubt that such horrors are possible absent proper design.

Bob Friesenhahn
GraphicsMagick Maintainer,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]