This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

Questions about __thread for NSS modules


Hi,

currently there is still on problem left with NIS and threads:

If for exmaple two concurrent threads calls getpwent_r() and NIS
is used, than both threads will not see all NIS passwd entries.

The reason is, that I need some static data to loop through the
NIS map. I use locks while the process is inside of this functions,
but I cannot hold a lock over different function calls.

So, if the following happens:

thread1 -> getpwent_r()
thread2 -> getpwent_r()
thread1 -> getpwent_r()
thread2 -> getpwent_r()

thread1 will never see the users thread2 gets, and thread2 will
never see the users thread1 will get. The reason is, that you always
needs to send the last entry you got back to get a new one, but
thread2 will use the last entry thread1 got.

One idea I had is to use thread local variables instead with NPTL.

My question is: is this possible at all in NSS modules like libnss_nis.so?
Do I need to link against libpthread? My first try ends in a 
unresolved "__tls_get_addr" symbol when I try to link the module.

  Thorsten
-- 
Thorsten Kukuk       http://www.suse.de/~kukuk/        kukuk@suse.de
SuSE Linux AG        Maxfeldstr. 5                 D-90409 Nuernberg
--------------------------------------------------------------------    
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B


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