[threadpool] Let the runtime abort and wait for threads on shutdown (#4348)
authorLudovic Henry <ludovic@xamarin.com>
Fri, 17 Feb 2017 19:47:24 +0000 (14:47 -0500)
committerGitHub <noreply@github.com>
Fri, 17 Feb 2017 19:47:24 +0000 (14:47 -0500)
commitcd1fb047330603d08d2882b0ac812d194cbea0c6
treece834b33492a55e59c6db22c90e61ca959ea1ec8
parentb495a722fe111a9de08b41a0146d060dbcca5981
[threadpool] Let the runtime abort and wait for threads on shutdown (#4348)

* [threadpool] Let the runtime abort and wait for threads on shutdown

We would previously have the threadpool abort and wait for its threads during runtime shutdown, but it would tend to be buggy or leaky. The runtime already takes care of aborting and waiting all the other threads, so we simply also let it take care of the threadpool threads.

* [threadpool] Wake up all parked threads on shutdown

This fixes a hang at shutdown, where one or more threadpool threads might not be unparked and only exit after the timeout, delaying runtime shutdown.
mono/metadata/gc-internals.h
mono/metadata/gc.c
mono/metadata/runtime.c
mono/metadata/threadpool-io.c
mono/metadata/threadpool-worker-default.c
mono/metadata/threadpool.c
mono/metadata/threads.c
mono/mini/mini-runtime.c
mono/utils/mono-lazy-init.h