Procházet zdrojové kódy

[corlib] ConcurrentExclusiveSchedulerPair from corefx (#8040)

These types were not replaced with corefx in #6672
Egor Bogatov před 7 roky
rodič
revize
965f7aef2a

+ 1 - 1
external/api-snapshot

@@ -1 +1 @@
-Subproject commit 09cf95cdc9c2dbb8c586f4518ec15b69f133eea8
+Subproject commit eb4379c5593858688bb3f0a6cf255b39a5a56e43

+ 1 - 1
external/corert

@@ -1 +1 @@
-Subproject commit 2b3a7ff02e349d36983d9c32c1de2b8f7b6e8da0
+Subproject commit b5c0b65ea311f5a55fcd44115b635755e9f04b47

+ 10 - 0
mcs/class/corlib/System.Threading/WaitHandle.cs

@@ -179,5 +179,15 @@ namespace System.Threading
 
 		[MethodImplAttribute(MethodImplOptions.InternalCall)]
 		static extern int SignalAndWait_Internal (IntPtr toSignal, IntPtr toWaitOn, int ms);
+
+		internal static int ToTimeoutMilliseconds(TimeSpan timeout)
+		{
+			var timeoutMilliseconds = (long)timeout.TotalMilliseconds;
+			if (timeoutMilliseconds < -1 || timeoutMilliseconds > int.MaxValue)
+			{
+				throw new ArgumentOutOfRangeException(nameof(timeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
+			}
+			return (int)timeoutMilliseconds;
+		}
 	}
 }

+ 4 - 4
mcs/class/corlib/corlib.csproj

@@ -226,6 +226,7 @@
     <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\Threading\Tasks\TaskCanceledException.cs" />
     <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\Threading\Tasks\TaskCompletionSource.cs" />
     <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\Threading\Tasks\TaskSchedulerException.cs" />
+    <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\Threading\Tasks\TaskToApm.cs" />
     <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\Threading\Tasks\ValueTask.cs" />
     <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\Tuple.cs" />
     <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\TupleExtensions.cs" />
@@ -305,12 +306,15 @@
     <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\String.Comparison.cs" />
     <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\String.cs" />
     <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Threading\LockHolder.cs" />
+    <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Threading\Tasks\ConcurrentExclusiveSchedulerPair.cs" />
     <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Threading\Tasks\DebuggerSupport.cs" />
     <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Threading\Tasks\DebuggerSupport.Dummy.cs" />
     <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Threading\Tasks\Future.cs" />
     <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Threading\Tasks\FutureFactory.cs" />
+    <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Threading\Tasks\ProducerConsumerQueues.cs" />
     <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs" />
     <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Threading\Tasks\TaskContinuation.cs" />
+    <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Threading\Tasks\TaskExceptionHolder.cs" />
     <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Threading\Tasks\TaskFactory.cs" />
     <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Threading\Tasks\TaskScheduler.cs" />
     <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Threading\Tasks\ThreadPoolTaskScheduler.cs" />
@@ -921,10 +925,6 @@
     <Compile Include="..\referencesource\mscorlib\system\threading\synchronizationcontext.cs" />
     <Compile Include="..\referencesource\mscorlib\system\threading\synchronizationlockexception.cs" />
     <Compile Include="..\referencesource\mscorlib\system\threading\Tasks\AsyncCausalityTracer.cs" />
-    <Compile Include="..\referencesource\mscorlib\system\threading\Tasks\ConcurrentExclusiveSchedulerPair.cs" />
-    <Compile Include="..\referencesource\mscorlib\system\threading\Tasks\ProducerConsumerQueues.cs" />
-    <Compile Include="..\referencesource\mscorlib\system\threading\Tasks\TaskExceptionHolder.cs" />
-    <Compile Include="..\referencesource\mscorlib\system\threading\Tasks\TaskToApm.cs" />
     <Compile Include="..\referencesource\mscorlib\system\threading\thread.cs" />
     <Compile Include="..\referencesource\mscorlib\system\threading\threadabortexception.cs" />
     <Compile Include="..\referencesource\mscorlib\system\threading\threadinterruptedexception.cs" />

+ 4 - 5
mcs/class/corlib/corlib.dll.sources

@@ -1521,11 +1521,10 @@ ReferenceSources/AppContextDefaultValues.cs
 ../referencesource/mscorlib/system/threading/waithandleExtensions.cs
 
 ../referencesource/mscorlib/system/threading/Tasks/AsyncCausalityTracer.cs
-
-../referencesource/mscorlib/system/threading/Tasks/TaskExceptionHolder.cs
-../referencesource/mscorlib/system/threading/Tasks/ConcurrentExclusiveSchedulerPair.cs
-../referencesource/mscorlib/system/threading/Tasks/ProducerConsumerQueues.cs
-../referencesource/mscorlib/system/threading/Tasks/TaskToApm.cs
+../../../external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskExceptionHolder.cs
+../../../external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/ConcurrentExclusiveSchedulerPair.cs
+../../../external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/ProducerConsumerQueues.cs
+../../../external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/TaskToApm.cs
 
 ../referencesource/mscorlib/microsoft/win32/safehandles/safefilehandle.cs
 ../referencesource/mscorlib/microsoft/win32/safehandles/safefindhandle.cs