public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Thorsten Kukuk <kukuk@suse.de>
To: libc-hacker@sources.redhat.com
Subject: Questions about __thread for NSS modules
Date: Thu, 26 Aug 2004 09:58:00 -0000	[thread overview]
Message-ID: <20040826095808.GA6880@suse.de> (raw)


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

             reply	other threads:[~2004-08-26  9:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-26  9:58 Thorsten Kukuk [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040826095808.GA6880@suse.de \
    --to=kukuk@suse.de \
    --cc=libc-hacker@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).