This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: [PATCH] libdw: add thread-safety to dwarf_getabbrev()
- From: Florian Weimer <fw at deneb dot enyo dot de>
- To: Mark Wielaard <mark at klomp dot org>
- Cc: Jonathon Anderson <jma14 at rice dot edu>, elfutils-devel at sourceware dot org, Srdan Milakovic <sm108 at rice dot edu>
- Date: Sat, 26 Oct 2019 18:14:47 +0200
- Subject: Re: [PATCH] libdw: add thread-safety to dwarf_getabbrev()
- References: <1565983469.1826.0@smtp.mail.rice.edu> <20190824232438.GA2622@wildebeest.org> <1566695452.979.1@smtp.mail.rice.edu> <5ba06557703ee363e19488c994cbddd92ade25be.camel@klomp.org> <1566782688.5803.0@smtp.mail.rice.edu> <ba2c453b09ddac529a3aa122402380f5d7f82b2a.camel@klomp.org> <1566826627.5246.0@smtp.mail.rice.edu> <1566877968.10901.0@smtp.mail.rice.edu> <87tv7vg4l0.fsf@mid.deneb.enyo.de> <8fde453a2c570fa150aa39b0dabd0f925c7b0970.camel@klomp.org>
* Mark Wielaard:
> I'll see if I can create a case where that is a problem. Then we can
> see how to adjust things to use less pthread_keys. Is there a different
> pattern we can use?
It's unclear what purpose thread-local storage serves in this context.
You already have a Dwarf *. I would consider adding some sort of
clone function which creates a shallow Dwarf * with its own embedded
allocator or something like that. This assumes that memory allocation
is actually a performance problem, otherwise you could let malloc
handle the details.