In mono_gc_cleanup, we use mono_thread_internal_stop to stop the finalizer thread.
That API is deprecated and is going untested.
We should replace it with a regular thread abort, by calling mono_thread_internal_abort.
To write a test case for this try the following:
Allocate objects with finalizers that take a long time (sleep, loops, etc).
Force a GC so those objects get in the finalizer queue.
Leave the main thread, triggering shutdown.
Ensure with CWLs and busy looping from the main thread, that we only leave it when finalization started.
This is a nice to have cleanup that would allow us to remove the last remaining user of thread stop, which is a very broken variant of thread abort.
We already abort the thread, the stop is done when the abort fails. _stop () is somewhat guaranteed to succeed.