Add null check for WaitInfo (#49628)
authorRyan Lucia <rylucia@microsoft.com>
Mon, 15 Mar 2021 11:49:50 +0000 (07:49 -0400)
committerGitHub <noreply@github.com>
Mon, 15 Mar 2021 11:49:50 +0000 (07:49 -0400)
* Add null check for WaitInfo

* Remove OnThreadExiting static from WaitSubsystem

src/libraries/System.Private.CoreLib/src/System/Threading/WaitSubsystem.Unix.cs
src/mono/System.Private.CoreLib/src/System/Threading/Thread.Mono.cs

index bd622d9..e259f38 100644 (file)
@@ -424,10 +424,5 @@ namespace System.Threading
                 s_lock.Release();
             }
         }
-
-        public static void OnThreadExiting(Thread thread)
-        {
-            thread.WaitInfo.OnThreadExiting();
-        }
     }
 }
index c1978ea..2c7c040 100644 (file)
@@ -82,7 +82,7 @@ namespace System.Threading
         ~Thread()
         {
 #if TARGET_UNIX || TARGET_BROWSER
-            WaitSubsystem.OnThreadExiting(this);
+            _waitInfo?.OnThreadExiting();
 #endif
             FreeInternal();
         }