Mark Mitchell wrote:

You also need documentation for this feature, discussing both the new
configure switch, and what you have to do to replace the generic
functions, and what the semantics of those functions are, so that people
know how to replace them.
The semantics of these functions are exactly that of the internal gthreads
interface of gcc. Of course, such a description is not very useful for a prospective implementor. I started to look at the sources to come up with descriptions, and
found that this interface is not even self-consistent.

gthr.h states that a number of functions can -1 for unimplemented operations,
and various stub implementations do just that.

The logic in uw_init_context_1:unwind-dw2.c is garbled so that when __GTHREADS is defined but __gthread_once is unimplemented, init_dwarf_reg_size_table is
called all the time:

#if __GTHREADS
 {
   static __gthread_once_t once_regsizes = __GTHREAD_nit_dwONCE_INIT;
   if (__gthread_once (&once_regsizes, init_dwarf_reg_size_table) != 0
       || dwarf_reg_size_table[0] == 0)
     init_dwarf_reg_size_table ();
 }
#else
 if (dwarf_reg_size_table[0] == 0)
   init_dwarf_reg_size_table ();
#endif

That '||' should rather be an '&&'.

Or maybe we should make __gthread_once also succeed in the non-threading case?
That should be simple enough, and should also allow to simplify
libstdc++-v3/include/ext/mt_allocator.h .


Reply via email to