-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mono] More Threading changes (#49637)
* Move CurrentOSThreadId to shared * Set t_currentThread in managed * Remove native abandon_mutexes calls Abandoning in managed seems to work fine * Switch to managed Sleep * Remove threads shutting_down state * Remove more domain usage * Move some files to shared per feedback * Re-add shutting_down flag * Eliminate helper method for timeout verification * Remove argument validation in ThreadNative::Sleep * Abandon mutexes on finalizer thread * Rename to thread_exiting * Move OnThreadExiting to Thread * Fix build * Build build part 2 * Switch to DynamicDependency * Avoid calling managed while holding a lock * Don't leak gchandles * Clean up rebase * Pt 2
- Loading branch information
1 parent
0be8b88
commit 457f58c
Showing
17 changed files
with
172 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/libraries/System.Private.CoreLib/src/System/Threading/Thread.Unix.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Microsoft.Win32.SafeHandles; | ||
using System.Diagnostics; | ||
using System.Runtime; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace System.Threading | ||
{ | ||
public sealed partial class Thread | ||
{ | ||
internal static void UninterruptibleSleep0() => WaitSubsystem.UninterruptibleSleep0(); | ||
|
||
private static void SleepInternal(int millisecondsTimeout) => WaitSubsystem.Sleep(millisecondsTimeout); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/libraries/System.Private.CoreLib/src/System/Threading/Thread.Windows.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Microsoft.Win32.SafeHandles; | ||
using System.Diagnostics; | ||
using System.Runtime; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace System.Threading | ||
{ | ||
public sealed partial class Thread | ||
{ | ||
internal static void UninterruptibleSleep0() => Interop.Kernel32.Sleep(0); | ||
|
||
private static void SleepInternal(int millisecondsTimeout) | ||
{ | ||
Debug.Assert(millisecondsTimeout >= -1); | ||
Interop.Kernel32.Sleep((uint)millisecondsTimeout); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.