Detach the current thread as soon as possible when mono_gc_pthread_exit is called.

	* sgen-gc.c (mono_gc_pthread_exit): Given the current thread is doomed, explicitly
	detach before calling pthread_exit and thus reducing the chance of TLS cleanup issues.
Kill unused func mono_threads_is_shutting_down.
Don't set shutting_down here as it is now done much earlier in the shutdown sequence.
Move mono_runtime_set_shutting_down and mono_runtime_is_shutting_down to runtime.c
Rework the shutdown sequence so two initiations don't race each other.

	This fixes a race condition where two threads could perform runtime shutdown
	at the same time and either crash or hang. Now each initiation checks if they
	won and take the proper action in such case.

	A recurring problem was with the debugger, that would hang on shutdown if the
	main thread started shutdown earlier. In this case the agent thread would
	call into mono_threads_set_shutting_down, which in turn would do an ExitThread
	since shutdown was in progress.

	The agent thread would exit without signaling that it did complete, causing
	the main thread to block waiting for it to do so.

	* runtime.c (mono_runtime_shutdown): Rename it to mono_runtime_try_shutdown
	and move threadpool cleanup to here. Some cleanup of the rest of the sequence
	still left to do.

	* icall.c (Environment.Exit): If we fail to start shutdown, just exit
	the thread as someone else will finish the job. We can't suspend because if
	this is called by regular shutdown we would be resumed and return to user code.

	An alternative would be to detach and then suspend. Not sure on the merits.

	* threads.c (mono_thread_manage): If we fail to start shutdown, suspend
	as this is what the winner initiator wants us to do as it must be for
	forced exit.

	* debugger-agent.c (vm_commands): If we fail to start shutdown, return
	from the function and let the agent thread finish and clean up.

	* debugger-agent.c (debugger_thread): VM_EXIT commands now can return
	if shutdown was externaly initiated and in such case we should break
	the main loop and let the agent thread finish.