On 8/2/23 18:55, Tom Tromey wrote: >>>>>> "Tom" == Tom de Vries via Gdb-patches writes: > >>> I wonder if it's enough to have: >>> static std::thread::id main_thread_id = std::this_thread::get_id (); > > Tom> In principle it's enough but it does expose us to the "Static > Tom> Initialization Order Fiasco" [1], so I prefer this solution. > > If we think it's safe enough to initialize it on first use, just moving > the definition into is_main_thread is enough to avoid this problem. > Done. > Now, in theory it is possible for gdb to start a thread very early and > then have that thread call is_main_thread, setting the global > incorrectly. If we care about that then we need an explicit call to set > it early during startup. Yes, Pedro had the same remark, that was already fixed in the previous version. Any further comments? Thanks, - Tom