Hi Frank, On Thu, 2025-09-04 at 14:30 -0400, Frank Ch. Eigler wrote: > > > > Maybe we just have to say that you cannot share Dwarf_Die references > > > > between threads? So if you want to use a Dwarf_Die from another thread > > > > you have to copy it instead by passing it by reference? [...] > > > > (Exactly. The Dwarf_Die object is small enough, 4 pointers, to be > > simply copied in toto.) > > No, that wouldn't help the situation (possible copy while another > thread is updating ->abbrev).
But that cannot happen if we say you cannot share Dwarf_Die references between threads. While you (the thread passing a Dwarf_Die to another thread) are making the copy of the ref, nobody else has a copy, so the only thread that can possibly be updating the abbrev field is you (and you aren't because you are making the copy). And after the copy is made and passed to another thread nobody else has a reference to that new Dwarf_Die except the receiving thread. Cheers, Mark