Question about rtld-elf. Anyone?.. Anyone?
Daniel Eischen
eischen at pcnet1.pcnet.com
Mon Apr 28 22:28:35 PDT 2003
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
More information about the freebsd-threads
mailing list