public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* Questions about __thread for NSS modules
@ 2004-08-26  9:58 Thorsten Kukuk
  2004-08-26 10:20 ` Roland McGrath
  0 siblings, 1 reply; 7+ messages in thread
From: Thorsten Kukuk @ 2004-08-26  9:58 UTC (permalink / raw)
  To: libc-hacker


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-09-09  5:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-26  9:58 Questions about __thread for NSS modules Thorsten Kukuk
2004-08-26 10:20 ` Roland McGrath
2004-08-26 12:06   ` Thorsten Kukuk
2004-08-30  4:18     ` Roland McGrath
2004-09-08 16:38   ` Thorsten Kukuk
2004-09-08 20:40     ` Roland McGrath
2004-09-09  5:00       ` Thorsten Kukuk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).