[threadpool-ms] Fix use-after-unloaded of domain
commit2bd1dbd79b3c88e216caecef99b6507b76881ec5
authorLudovic Henry <ludovic@xamarin.com>
Tue, 26 Jul 2016 11:22:34 +0000 (26 13:22 +0200)
committerLudovic Henry <ludovic@xamarin.com>
Tue, 26 Jul 2016 11:22:34 +0000 (26 13:22 +0200)
tree8cd887b848acc4d1a5334da0f6222a678b732e45
parentc2151a9177918ec2510484d8185211bdc891c140
[threadpool-ms] Fix use-after-unloaded of domain

The following scenario might happen:
 - thread A: returns from tpdomain D1, then parks
 - thread B: returns from tpdomain D1, D1 is unloading so it's removed with `domain_remove`
 - thread A: unparks, calls `domain_get_next` with tpdomain D1
  - domain_get_next asserts as it can't find tpdomain D1 in the list of domains

To fix that, we simply set the previous_tpdomain to NULL when unparking.
mono/metadata/threadpool-ms.c