/
Monitor.cs
32 lines (25 loc) · 1.33 KB
/
Monitor.cs
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
// 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);
[UnsupportedOSPlatform("browser")]
public static bool Wait(object obj, TimeSpan timeout) => Wait(obj, WaitHandle.ToTimeoutMilliseconds(timeout));
[UnsupportedOSPlatform("browser")]
public static bool Wait(object obj) => Wait(obj, Timeout.Infinite);
// Remoting is not supported, exitContext argument is unused
[UnsupportedOSPlatform("browser")]
public static bool Wait(object obj, int millisecondsTimeout, bool exitContext)
=> Wait(obj, millisecondsTimeout);
// Remoting is not supported, exitContext argument is unused
[UnsupportedOSPlatform("browser")]
public static bool Wait(object obj, TimeSpan timeout, bool exitContext)
=> Wait(obj, WaitHandle.ToTimeoutMilliseconds(timeout));
}
}