[threads] Ensure thread is still alive when detaching it
authorLudovic Henry <ludovic@xamarin.com>
Fri, 16 Dec 2016 18:42:36 +0000 (13:42 -0500)
committerLudovic Henry <ludovic@xamarin.com>
Fri, 16 Dec 2016 18:42:38 +0000 (13:42 -0500)
commitf4fdfcc714328cba1379f25590aa51128c558743
tree66cf70c16436015f47d4bc6696656ed94758cd7f
parentb8072d9de055dfaaf4e93b080bb5bc5e56ad3a1a
[threads] Ensure thread is still alive when detaching it

If the compiler optimized it so that we would unregister the thread->thread_pinning_ref GC root before we would destroy the thread fields, we could run into "* Assertion at threads.c:1081, condition 'thread->suspended' not met"
mono/metadata/threads.c