GC.cleanupThread

void cleanupThread(ThreadBase thread) nothrow @nogc

Clean up any GC related data from the thread before it exits. There is no equivalent of this function as a hook before the GC is initialized. That is, the thread init function called before the GC is initialized (from the registry hook) should assume this function may not be called on termination if the GC is never initialized.

This function is only called from a thread that was started from the D runtime, and is terminating. The GC can assume the thread is still in the list of running threads and can be paused for a GC cycle. This is not called for the main thread which initialized the GC.