Fix deadlock in thread startup mechanism

This would cause a deadlock when a thread would start, but the hard_lock
code would happen at the same time a GC happens and also the thread was
still starting. This meant the thread that started the thread would
never get the init_lock and thus would wait indefinitely.

This would cause the GC not to be ever happening, having two locks
waiting for each other and never seeing any finish.