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

Ivan Maidanski ivmai at mail.ru
Sat Dec 7 07:59:55 PST 2013


Hi Basile, 

You could avoid GC_allow_register_threads call by compiling libgc (obtained from recent master branch) with -D GC_ALWAYS_MULTITHREADED.
The use case of this opinion is when application creates at least one thread right at its start, so that GC locks could be done unconditionally.

Regards, 
Ivan


 Thursday,  19 Sept 2013, 14:07 +02:00 from Basile Starynkevitch <basile at starynkevitch.net>:
> 
> 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} ***
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> https://www.hpl.hp.com/hosted/linux/mail-archives/gc/

> 

--
Отправлено из мобильной Почты Mail.Ru



More information about the Gc mailing list