Re: GIO will link with -pthread soon



Behdad Esfahbod wrote:
> On 11/11/2009 11:10 PM, Ryan Lortie wrote:
> 
> > libdbus links against libpthread.
> 
> My only question  is: can't this be fixed instead?  I don't immediately see 
> why not..

The problem is much deeper - in the ELF format and it is not a bug. ELF
features interposing - a possibility to use more implementations of the
same function inside the same library.

glibc is probably the only user of interposing: If the application is
linked against pthread, ELF interposing links to thread safe calls in
the glibc. If the application does not link against pthread, ELF
interposing links to faster bug thread unsafe calls in the glibc.


Suppose that the application does not use threads. Interposing selects
thread unsafe calls. And now imagine that any gmodule (theme engine,
input module, file system) links to pthread.

Interposing works on library loading and later loading of pthread does
not have any effect. And you have a problem, that may even cause crashes
or strange behavior. Problem of gdb is a minor issue, easily
work-around-able by detach/attach cycle.


If you want to link with pthread, gmodule may be a better candidate.

Other possibilities:

- Reimplement thread optimization in glibc.

- Cleanly say, that dynamic loading of modules linked with libpthread is
not recommended.


-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: sbrabec suse cz
Lihovarská 1060/12           tel: +420 284 028 966, +49 911 740538747
190 00 Praha 9                                  fax: +420 284 028 951
Czech Republic                                    http://www.suse.cz/



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