[Gc] libgc and std::thread (gcc 4.8/Linux/Debian) in C++11 and GC_register_my_thread

Basile Starynkevitch basile at starynkevitch.net
Thu Sep 19 05:07:58 PDT 2013


On Thu, Sep 19, 2013 at 01:59:13PM +0200, Basile Starynkevitch wrote:
> Hello all,
> But at runtime I'm getting an abort with
>  registering GC for thread #1
>  Threads explicit registering is not previously enabled

For what it is worth, calling very early GC_allow_register_threads like


int main (int argc, char** argv)
{
  static_assert (sizeof(State)<sizeof(intptr_t), "State should not have any data member");
  GC_INIT();
  GC_allow_register_threads ();
  
did solve that particular issue. No more abort from libgc.

But I still don't know if when using std::thread all this is needed.

Cheers.

-- 
Basile STARYNKEVITCH         https://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***


More information about the Gc mailing list