LDC_global_crt_ctor for threads

kinke noone at nowhere.com
Fri Apr 3 00:37:39 UTC 2020


On Thursday, 2 April 2020 at 22:16:45 UTC, Marcel wrote:
> Oh, I didn't explain my situation properly: I'm writing a 
> memory allocation library and there's some thread local state 
> that I must take care of when the thread exits. Now, I can 
> always do as you said and ask the user to place calls to 
> certain functions at thread main, but I'd really prefer if that 
> was done automatically.

You'll need some sort of runtime support for automation, so if 
you don't use druntime because of -betterC, you'll need to look 
(and ask) elsewhere. C doesn't have such a thing AFAIK; the C++ 
runtime may have something like __cxa_thread_atexit (e.g., used 
by clang for a thread_local global with dtor when targeting 
glibc).


More information about the digitalmars-d-ldc mailing list