Date: Tue, 29 Apr 2003 01:28:33 -0400 (EDT) From: Daniel Eischen <eischen@pcnet1.pcnet.com> To: Peter Wemm <peter@wemm.org> Cc: threads@freebsd.org Subject: Re: Question about rtld-elf. Anyone?.. Anyone? Message-ID: <Pine.GSO.4.10.10304290123480.25408-100000@pcnet1.pcnet.com> In-Reply-To: <20030429041716.A14182A7EA@canning.wemm.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 28 Apr 2003, Peter Wemm wrote: > Daniel Eischen wrote: > > So I was glancing at rltd-elf, specifically lockdflt.c. There > > seems to be an assumption that sigprocmask() can be used to > > protect a thread from being swapped out. Am I reading this > > right? > > I dont think so.. i386/lockdflt.c is just a simple spinlock that happens > to work with libc_r. > > > There are no such guarantees with libpthread. A thread > > will be swapped out whenever its quantum expires, and if > > you've got higher priority threads, they will always run > > before those of lower priority -- even if they are spinning. > > If this is happening, it would not suprise me. lockdflt.c seems more aimed > at things like the M3 runtime. > > I think the real solution is to provide a way for a thread library to hook > in its own lock routines that use something that is thread aware. However, > this is probably easier said than done. Well, libc can do it by checking __isthreaded and then using mutexes. Libraries such as libgcc can also handle it by making weak references (not definitions) to pthread_foo and then using them when they are not null. I don't know if this works for rtld though. > Basically he's describing the exact scenario you're concerned about. The > last paragraph suggests a better way. John, any details about what you were thinking here? -- Dan Eischen
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10304290123480.25408-100000>