-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Expand file tree
/
Copy pathMonitor.cs
More file actions
40 lines (33 loc) · 1.46 KB
/
Monitor.cs
File metadata and controls
40 lines (33 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Runtime.Versioning;
namespace System.Threading
{
public static partial class Monitor
{
public static bool TryEnter(object obj, TimeSpan timeout)
=> TryEnter(obj, WaitHandle.ToTimeoutMilliseconds(timeout));
public static void TryEnter(object obj, TimeSpan timeout, ref bool lockTaken)
=> TryEnter(obj, WaitHandle.ToTimeoutMilliseconds(timeout), ref lockTaken);
#if !FEATURE_WASM_THREADS
[UnsupportedOSPlatform("browser")]
#endif
public static bool Wait(object obj, TimeSpan timeout) => Wait(obj, WaitHandle.ToTimeoutMilliseconds(timeout));
#if !FEATURE_WASM_THREADS
[UnsupportedOSPlatform("browser")]
#endif
public static bool Wait(object obj) => Wait(obj, Timeout.Infinite);
// Remoting is not supported, exitContext argument is unused
#if !FEATURE_WASM_THREADS
[UnsupportedOSPlatform("browser")]
#endif
public static bool Wait(object obj, int millisecondsTimeout, bool exitContext)
=> Wait(obj, millisecondsTimeout);
// Remoting is not supported, exitContext argument is unused
#if !FEATURE_WASM_THREADS
[UnsupportedOSPlatform("browser")]
#endif
public static bool Wait(object obj, TimeSpan timeout, bool exitContext)
=> Wait(obj, WaitHandle.ToTimeoutMilliseconds(timeout));
}
}