This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: dlopen handles and multiple threads


On Thu, Jul 03, 2014 at 10:22:13AM +0000, Matthew Fortune wrote:
> Hi all,
> 
> Can anyone tell me with confidence whether either of the following
> scenarios are valid relating to sharing code between threads:
> 
> [...]
> Thread 1 notifies thread 2 that the handle is available (by whatever mechanism)

This step is the only one which is suspicious. I'm not clear what "by
whatever mechanism" means, but if the mechanism is anything other than
one of the standard functions which synchronizes memory (e.g.
pthread_mutex_lock/unlock or sem_wait/post) or an atomic operation
which does so, it's not valid.

As long as this is done correctly, both scenarios are fully valid, and
in fact you would expect them to occur in ordinary usage -- for
example, consider a gui application where the gui is running in a
separate thread and another thread loads a module for a feature and
registers interface elements for it, where the gui will later callback
indirectly into the code from the loaded module.

Rich


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]