You've already forked linux-packaging-mono
Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
parent
1190d13a04
commit
6bdd276d05
73
external/corefx/src/System.Threading.Timer/System.Threading.Timer.sln
vendored
Normal file
73
external/corefx/src/System.Threading.Timer/System.Threading.Timer.sln
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.21005.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Threading.Timer.Tests", "tests\System.Threading.Timer.Tests.csproj", "{AC20A28F-FDA8-45E8-8728-058EAD16E44C}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{} = {}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Threading.Timer", "src\System.Threading.Timer.csproj", "{248D07D6-0DA9-4F3B-9F05-A17C72F3EDAA}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{9BA4D6A6-C48D-4470-8FA6-D12102F47EA5}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{C68160F1-EC89-4B68-B2FE-9DB33E6360CE}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{32AFC2C9-4EE5-4EE7-A5D8-8FBF49D488A3}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Threading.Timer", "ref\System.Threading.Timer.csproj", "{97EEEDF4-D074-4D68-BB1D-B7C3EE36D522}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU = DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU
|
||||
ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU = ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU
|
||||
DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU = DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU
|
||||
ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU = ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU
|
||||
DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU = DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU
|
||||
ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU = ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU
|
||||
DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU = DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU
|
||||
ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU = ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{AC20A28F-FDA8-45E8-8728-058EAD16E44C}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{AC20A28F-FDA8-45E8-8728-058EAD16E44C}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{AC20A28F-FDA8-45E8-8728-058EAD16E44C}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{AC20A28F-FDA8-45E8-8728-058EAD16E44C}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{AC20A28F-FDA8-45E8-8728-058EAD16E44C}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{AC20A28F-FDA8-45E8-8728-058EAD16E44C}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{AC20A28F-FDA8-45E8-8728-058EAD16E44C}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{AC20A28F-FDA8-45E8-8728-058EAD16E44C}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{AC20A28F-FDA8-45E8-8728-058EAD16E44C}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{AC20A28F-FDA8-45E8-8728-058EAD16E44C}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{AC20A28F-FDA8-45E8-8728-058EAD16E44C}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{AC20A28F-FDA8-45E8-8728-058EAD16E44C}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{AC20A28F-FDA8-45E8-8728-058EAD16E44C}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{AC20A28F-FDA8-45E8-8728-058EAD16E44C}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{AC20A28F-FDA8-45E8-8728-058EAD16E44C}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{AC20A28F-FDA8-45E8-8728-058EAD16E44C}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{248D07D6-0DA9-4F3B-9F05-A17C72F3EDAA}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = net463-Windows_NT-Debug|Any CPU
|
||||
{248D07D6-0DA9-4F3B-9F05-A17C72F3EDAA}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = net463-Windows_NT-Debug|Any CPU
|
||||
{248D07D6-0DA9-4F3B-9F05-A17C72F3EDAA}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = net463-Windows_NT-Release|Any CPU
|
||||
{248D07D6-0DA9-4F3B-9F05-A17C72F3EDAA}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = net463-Windows_NT-Release|Any CPU
|
||||
{248D07D6-0DA9-4F3B-9F05-A17C72F3EDAA}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = net463-Windows_NT-Debug|Any CPU
|
||||
{248D07D6-0DA9-4F3B-9F05-A17C72F3EDAA}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = net463-Windows_NT-Debug|Any CPU
|
||||
{248D07D6-0DA9-4F3B-9F05-A17C72F3EDAA}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = net463-Windows_NT-Release|Any CPU
|
||||
{248D07D6-0DA9-4F3B-9F05-A17C72F3EDAA}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = net463-Windows_NT-Release|Any CPU
|
||||
{248D07D6-0DA9-4F3B-9F05-A17C72F3EDAA}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{248D07D6-0DA9-4F3B-9F05-A17C72F3EDAA}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{248D07D6-0DA9-4F3B-9F05-A17C72F3EDAA}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{248D07D6-0DA9-4F3B-9F05-A17C72F3EDAA}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{248D07D6-0DA9-4F3B-9F05-A17C72F3EDAA}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{248D07D6-0DA9-4F3B-9F05-A17C72F3EDAA}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{248D07D6-0DA9-4F3B-9F05-A17C72F3EDAA}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{248D07D6-0DA9-4F3B-9F05-A17C72F3EDAA}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{AC20A28F-FDA8-45E8-8728-058EAD16E44C} = {AC20A28F-FDA8-45E8-8728-058EAD16E44C}
|
||||
{248D07D6-0DA9-4F3B-9F05-A17C72F3EDAA} = {248D07D6-0DA9-4F3B-9F05-A17C72F3EDAA}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
8
external/corefx/src/System.Threading.Timer/dir.props
vendored
Normal file
8
external/corefx/src/System.Threading.Timer/dir.props
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\dir.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyVersion>4.1.0.0</AssemblyVersion>
|
||||
<IsNETCoreApp>true</IsNETCoreApp>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
9
external/corefx/src/System.Threading.Timer/ref/Configurations.props
vendored
Normal file
9
external/corefx/src/System.Threading.Timer/ref/Configurations.props
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
netcoreapp;
|
||||
uap;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
29
external/corefx/src/System.Threading.Timer/ref/System.Threading.Timer.cs
vendored
Normal file
29
external/corefx/src/System.Threading.Timer/ref/System.Threading.Timer.cs
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
// ------------------------------------------------------------------------------
|
||||
// Changes to this file must follow the http://aka.ms/api-review process.
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace System.Threading
|
||||
{
|
||||
public sealed class Timer : System.MarshalByRefObject, System.IDisposable
|
||||
{
|
||||
public Timer(System.Threading.TimerCallback callback) { }
|
||||
public Timer(System.Threading.TimerCallback callback, object state, int dueTime, int period) { }
|
||||
public Timer(System.Threading.TimerCallback callback, object state, long dueTime, long period) { }
|
||||
public Timer(System.Threading.TimerCallback callback, object state, System.TimeSpan dueTime, System.TimeSpan period) { }
|
||||
[System.CLSCompliantAttribute(false)]
|
||||
public Timer(System.Threading.TimerCallback callback, object state, uint dueTime, uint period) { }
|
||||
public bool Change(int dueTime, int period) { throw null; }
|
||||
public bool Change(long dueTime, long period) { throw null; }
|
||||
public bool Change(System.TimeSpan dueTime, System.TimeSpan period) { throw null; }
|
||||
[System.CLSCompliantAttribute(false)]
|
||||
public bool Change(uint dueTime, uint period) { throw null; }
|
||||
public void Dispose() { }
|
||||
public bool Dispose(System.Threading.WaitHandle notifyObject) { throw null; }
|
||||
}
|
||||
|
||||
public delegate void TimerCallback(object state);
|
||||
}
|
||||
15
external/corefx/src/System.Threading.Timer/ref/System.Threading.Timer.csproj
vendored
Normal file
15
external/corefx/src/System.Threading.Timer/ref/System.Threading.Timer.csproj
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<Compile Include="System.Threading.Timer.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
9
external/corefx/src/System.Threading.Timer/src/Configurations.props
vendored
Normal file
9
external/corefx/src/System.Threading.Timer/src/Configurations.props
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
net463-Windows_NT;
|
||||
netcoreapp;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
21
external/corefx/src/System.Threading.Timer/src/System.Threading.Timer.csproj
vendored
Normal file
21
external/corefx/src/System.Threading.Timer/src/System.Threading.Timer.csproj
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyName>System.Threading.Timer</AssemblyName>
|
||||
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
|
||||
</PropertyGroup>
|
||||
<!-- Help VS understand available configurations -->
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='net463-Windows_NT-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='net463-Windows_NT-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<TargetingPackReference Include="mscorlib" Condition="'$(TargetGroup)' == 'net463'" />
|
||||
<TargetingPackReference Include="System.Private.CoreLib" Condition="'$(TargetGroup)' == 'netcoreapp'" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ReferenceFromRuntime Include="System.Private.CoreLib" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
9
external/corefx/src/System.Threading.Timer/tests/Configurations.props
vendored
Normal file
9
external/corefx/src/System.Threading.Timer/tests/Configurations.props
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
netstandard1.3;
|
||||
netstandard;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
16
external/corefx/src/System.Threading.Timer/tests/System.Threading.Timer.Tests.builds
vendored
Normal file
16
external/corefx/src/System.Threading.Timer/tests/System.Threading.Timer.Tests.builds
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<ItemGroup>
|
||||
<Project Include="System.Threading.Timer.Tests.csproj" />
|
||||
<Project Include="System.Threading.Timer.Tests.csproj">
|
||||
<TargetGroup>netstandard1.3</TargetGroup>
|
||||
<TestTFMs>netcoreapp1.0</TestTFMs>
|
||||
</Project>
|
||||
<Project Include="System.Threading.Timer.Tests.csproj">
|
||||
<OSGroup>Windows_NT</OSGroup>
|
||||
<TestTFMs>netcore50;net46</TestTFMs>
|
||||
</Project>
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
|
||||
</Project>
|
||||
23
external/corefx/src/System.Threading.Timer/tests/System.Threading.Timer.Tests.csproj
vendored
Normal file
23
external/corefx/src/System.Threading.Timer/tests/System.Threading.Timer.Tests.csproj
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{ac20a28f-fda8-45e8-8728-058ead16e44c}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<!-- Default configurations to help VS understand the configurations -->
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard1.3-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard1.3-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<Compile Include="TimerConstructorTests.cs" />
|
||||
<Compile Include="TimerChangeTests.cs" />
|
||||
<Compile Include="TimerFiringTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)' == 'netstandard'">
|
||||
<Compile Include="TimerConstructorTests.netstandard.cs" />
|
||||
<Compile Include="TimerChangeTests.netstandard.cs" />
|
||||
<Compile Include="TimerFiringTests.netstandard.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
98
external/corefx/src/System.Threading.Timer/tests/TimerChangeTests.cs
vendored
Normal file
98
external/corefx/src/System.Threading.Timer/tests/TimerChangeTests.cs
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using Xunit;
|
||||
|
||||
public partial class TimerChangeTests
|
||||
{
|
||||
private void EmptyTimerTarget(object o) { }
|
||||
|
||||
[Fact]
|
||||
public void Timer_Change_NegativeTimeSpan_DueTime_Throws()
|
||||
{
|
||||
using (var t = new Timer(new TimerCallback(EmptyTimerTarget), null, 1, 1))
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() =>t.Change(TimeSpan.FromMilliseconds(-2), new TimeSpan(1) /* not relevant */));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_Change_NegativeTimeSpan_Period_Throws()
|
||||
{
|
||||
using (var t = new Timer(new TimerCallback(EmptyTimerTarget), null, 1, 1))
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => t.Change(new TimeSpan(1) /* not relevant */, TimeSpan.FromMilliseconds(-2)));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_Change_NegativeInt_DueTime_Throws()
|
||||
{
|
||||
using (var t = new Timer(new TimerCallback(EmptyTimerTarget), null, 1, 1))
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => t.Change(-2, 1 /* not relevant */));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_Change_NegativeInt_Period_Throws()
|
||||
{
|
||||
using (var t = new Timer(new TimerCallback(EmptyTimerTarget), null, 1, 1))
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => t.Change(1 /* not relevant */, -2));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_Change_TooLongTimeSpan_DueTime_Throws()
|
||||
{
|
||||
using (var t = new Timer(new TimerCallback(EmptyTimerTarget), null, 1, 1))
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => t.Change(TimeSpan.FromMilliseconds((long)0xFFFFFFFF), new TimeSpan(1) /* not relevant */));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_Change_TooLongTimeSpan_Period_Throws()
|
||||
{
|
||||
using (var t = new Timer(new TimerCallback(EmptyTimerTarget), null, 1, 1))
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => t.Change(new TimeSpan(1) /* not relevant */, TimeSpan.FromMilliseconds((long)0xFFFFFFFF)));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_Change_TimeSpan_AfterDispose_Throws()
|
||||
{
|
||||
var t = new Timer(new TimerCallback(EmptyTimerTarget), null, 1, 1);
|
||||
t.Dispose();
|
||||
Assert.Throws<ObjectDisposedException>(() => t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_Change_Int_AfterDispose_Throws()
|
||||
{
|
||||
var t = new Timer(new TimerCallback(EmptyTimerTarget), null, 1, 1);
|
||||
t.Dispose();
|
||||
Assert.Throws<ObjectDisposedException>(() => t.Change(1, 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_Change_BeforeDueTime_ChangesWhenTimerWillFire()
|
||||
{
|
||||
AutoResetEvent are = new AutoResetEvent(false);
|
||||
|
||||
using (var t = new Timer(new TimerCallback((object s) =>
|
||||
{
|
||||
are.Set();
|
||||
}), null, TimeSpan.FromSeconds(500), TimeSpan.FromMilliseconds(50)))
|
||||
{
|
||||
Assert.False(are.WaitOne(TimeSpan.FromMilliseconds(100)), "The reset event should not have been set yet");
|
||||
t.Change(TimeSpan.FromMilliseconds(100), TimeSpan.FromMilliseconds(-1));
|
||||
Assert.True(are.WaitOne(TimeSpan.FromMilliseconds(TimerFiringTests.MaxPositiveTimeoutInMs)), "Should have received a timer event after this new duration");
|
||||
}
|
||||
}
|
||||
}
|
||||
28
external/corefx/src/System.Threading.Timer/tests/TimerChangeTests.netstandard.cs
vendored
Normal file
28
external/corefx/src/System.Threading.Timer/tests/TimerChangeTests.netstandard.cs
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using Xunit;
|
||||
|
||||
public partial class TimerChangeTests
|
||||
{
|
||||
[Fact]
|
||||
public void Timer_Change_Int64_Negative()
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget).Change((long)-2, (long)-1));
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget).Change((long)-1, (long)-2));
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget).Change((long)0xffffffff, (long)-1));
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget).Change((long)-1, (long)0xffffffff));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_Change_UInt32_Int64_AfterDispose_Throws()
|
||||
{
|
||||
var t = new Timer(EmptyTimerTarget);
|
||||
t.Dispose();
|
||||
Assert.Throws<ObjectDisposedException>(() => t.Change(0u, 0u));
|
||||
Assert.Throws<ObjectDisposedException>(() => t.Change(0L, 0L));
|
||||
}
|
||||
}
|
||||
75
external/corefx/src/System.Threading.Timer/tests/TimerConstructorTests.cs
vendored
Normal file
75
external/corefx/src/System.Threading.Timer/tests/TimerConstructorTests.cs
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using Xunit;
|
||||
|
||||
public partial class TimerConstructorTests
|
||||
{
|
||||
private void EmptyTimerTarget(object o) { }
|
||||
|
||||
[Fact]
|
||||
public void Timer_Constructor_NegativeTimeSpan_Period_Throws()
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(new Action(() =>
|
||||
{
|
||||
using (var t = new Timer(new TimerCallback(EmptyTimerTarget)/* not relevant */, null /* not relevant */, new TimeSpan(1) /* not relevant */, TimeSpan.FromMilliseconds(-2))) { }
|
||||
}));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_Constructor_NegativeInt_Period_Throws()
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(new Action(() =>
|
||||
{
|
||||
using (var t = new Timer(new TimerCallback(EmptyTimerTarget)/* not relevant */, null /* not relevant */, 1 /* not relevant */, -2)) { }
|
||||
}));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_Constructor_NegativeTimeSpan_DueTime_Throws()
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(new Action(() =>
|
||||
{
|
||||
using (var t = new Timer(new TimerCallback(EmptyTimerTarget)/* not relevant */, null /* not relevant */, TimeSpan.FromMilliseconds(-2), new TimeSpan(1) /* not relevant */)) { }
|
||||
}));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_Constructor_NegativeInt_DueTime_Throws()
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(new Action(() =>
|
||||
{
|
||||
using (var t = new Timer(new TimerCallback(EmptyTimerTarget)/* not relevant */, null /* not relevant */, -2, 1 /* not relevant */)) { }
|
||||
}));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_Constructor_TooLongTimeSpan_Period_Throws()
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(new Action(() =>
|
||||
{
|
||||
using (var t = new Timer(new TimerCallback(EmptyTimerTarget)/* not relevant */, null /* not relevant */, new TimeSpan(1) /* not relevant */, TimeSpan.FromMilliseconds((long)0xFFFFFFFF))) { }
|
||||
}));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_Constructor_TooLongTimeSpan_DueTime_Throws()
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(new Action(() =>
|
||||
{
|
||||
using (var t = new Timer(new TimerCallback(EmptyTimerTarget)/* not relevant */, null /* not relevant */, TimeSpan.FromMilliseconds((long)0xFFFFFFFF), new TimeSpan(1) /* not relevant */)) { }
|
||||
}));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_Constructor_Null_Callback_Throws()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(new Action(() =>
|
||||
{
|
||||
using (var t = new Timer(null, null /* not relevant */, new TimeSpan(1) /* not relevant */, new TimeSpan(1) /* not relevant */)) { }
|
||||
}));
|
||||
}
|
||||
}
|
||||
26
external/corefx/src/System.Threading.Timer/tests/TimerConstructorTests.netstandard.cs
vendored
Normal file
26
external/corefx/src/System.Threading.Timer/tests/TimerConstructorTests.netstandard.cs
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using Xunit;
|
||||
|
||||
public partial class TimerConstructorTests
|
||||
{
|
||||
[Fact]
|
||||
public void Timer_Constructor_CallbackOnly_Negative()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(() => new Timer(null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_Constructor_Int64_Negative()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(() => new Timer(null, null, (long)-1, (long)-1));
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget, null, (long)-2, (long)-1));
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget, null, (long)-1, (long)-2));
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget, null, (long)0xffffffff, (long)-1));
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget, null, (long)-1, (long)0xffffffff));
|
||||
}
|
||||
}
|
||||
186
external/corefx/src/System.Threading.Timer/tests/TimerFiringTests.cs
vendored
Normal file
186
external/corefx/src/System.Threading.Timer/tests/TimerFiringTests.cs
vendored
Normal file
@@ -0,0 +1,186 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Xunit;
|
||||
|
||||
public partial class TimerFiringTests
|
||||
{
|
||||
internal const int MaxPositiveTimeoutInMs = 30000;
|
||||
|
||||
[Fact]
|
||||
public void Timer_Fires_After_DueTime_Ellapses()
|
||||
{
|
||||
AutoResetEvent are = new AutoResetEvent(false);
|
||||
|
||||
using (var t = new Timer(new TimerCallback((object s) =>
|
||||
{
|
||||
are.Set();
|
||||
}), null, TimeSpan.FromMilliseconds(250), TimeSpan.FromMilliseconds(Timeout.Infinite) /* not relevant */))
|
||||
{
|
||||
Assert.True(are.WaitOne(TimeSpan.FromMilliseconds(MaxPositiveTimeoutInMs)));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_Fires_AndPassesStateThroughCallback()
|
||||
{
|
||||
AutoResetEvent are = new AutoResetEvent(false);
|
||||
|
||||
object state = new object();
|
||||
using (var t = new Timer(new TimerCallback((object s) =>
|
||||
{
|
||||
Assert.Same(s, state);
|
||||
are.Set();
|
||||
}), state, TimeSpan.FromMilliseconds(100), TimeSpan.FromMilliseconds(Timeout.Infinite) /* not relevant */))
|
||||
{
|
||||
Assert.True(are.WaitOne(TimeSpan.FromMilliseconds(MaxPositiveTimeoutInMs)));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_Fires_AndPassesNullStateThroughCallback()
|
||||
{
|
||||
AutoResetEvent are = new AutoResetEvent(false);
|
||||
|
||||
using (var t = new Timer(new TimerCallback((object s) =>
|
||||
{
|
||||
Assert.Null(s);
|
||||
are.Set();
|
||||
}), null, TimeSpan.FromMilliseconds(100), TimeSpan.FromMilliseconds(Timeout.Infinite) /* not relevant */))
|
||||
{
|
||||
Assert.True(are.WaitOne(TimeSpan.FromMilliseconds(MaxPositiveTimeoutInMs)));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_Fires_After_DueTime_AndOn_Period()
|
||||
{
|
||||
int count = 0;
|
||||
AutoResetEvent are = new AutoResetEvent(false);
|
||||
|
||||
using (var t = new Timer(new TimerCallback((object s) =>
|
||||
{
|
||||
if (Interlocked.Increment(ref count) >= 2)
|
||||
{
|
||||
are.Set();
|
||||
}
|
||||
}), null, TimeSpan.FromMilliseconds(250), TimeSpan.FromMilliseconds(50)))
|
||||
{
|
||||
Assert.True(are.WaitOne(TimeSpan.FromMilliseconds(MaxPositiveTimeoutInMs)));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_FiresOnlyOnce_OnDueTime_With_InfinitePeriod()
|
||||
{
|
||||
int count = 0;
|
||||
AutoResetEvent are = new AutoResetEvent(false);
|
||||
|
||||
using (var t = new Timer(new TimerCallback((object s) =>
|
||||
{
|
||||
if (Interlocked.Increment(ref count) >= 2)
|
||||
{
|
||||
are.Set();
|
||||
}
|
||||
}), null, TimeSpan.FromMilliseconds(100), TimeSpan.FromMilliseconds(Timeout.Infinite) /* not relevant */))
|
||||
{
|
||||
Assert.False(are.WaitOne(TimeSpan.FromMilliseconds(250 /*enough for 2 fires + buffer*/)));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_CanDisposeSelfInCallback()
|
||||
{
|
||||
Timer t = null;
|
||||
AutoResetEvent are = new AutoResetEvent(false);
|
||||
TimerCallback tc = new TimerCallback((object o) =>
|
||||
{
|
||||
t.Dispose();
|
||||
are.Set();
|
||||
});
|
||||
t = new Timer(tc, null, -1, -1);
|
||||
t.Change(1, -1);
|
||||
Assert.True(are.WaitOne(MaxPositiveTimeoutInMs));
|
||||
GC.KeepAlive(t);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_CanBeDisposedMultipleTimes()
|
||||
{
|
||||
// There's nothing to validate besides that we don't throw an exception, so rely on xunit
|
||||
// to catch any exception that would be thrown and signal a test failure
|
||||
TimerCallback tc = new TimerCallback((object o) => { });
|
||||
var t = new Timer(tc, null, 100, -1);
|
||||
for (int i = 0; i < 10; i++)
|
||||
t.Dispose();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NonRepeatingTimer_ThatHasAlreadyFired_CanChangeAndFireAgain()
|
||||
{
|
||||
AutoResetEvent are = new AutoResetEvent(false);
|
||||
TimerCallback tc = new TimerCallback((object o) => are.Set());
|
||||
using (var t = new Timer(tc, null, 1, Timeout.Infinite))
|
||||
{
|
||||
Assert.True(are.WaitOne(MaxPositiveTimeoutInMs), "Should have received first timer event");
|
||||
Assert.False(are.WaitOne(500), "Should not have received a second timer event");
|
||||
t.Change(10, Timeout.Infinite);
|
||||
Assert.True(are.WaitOne(MaxPositiveTimeoutInMs), "Should have received a second timer event after changing it");
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Running_Timer_CanBeFinalizedAndStopsFiring()
|
||||
{
|
||||
AutoResetEvent are = new AutoResetEvent(false);
|
||||
TimerCallback tc = new TimerCallback((object o) => are.Set());
|
||||
var t = new Timer(tc, null, 1, 500);
|
||||
Assert.True(are.WaitOne(MaxPositiveTimeoutInMs), "Failed to get first timer fire");
|
||||
t = null; // Remove our refence so the timer can be GC'd
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
GC.Collect();
|
||||
Assert.False(are.WaitOne(500), "Should not have received a timer fire after it was collected");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MultpleTimers_PeriodicTimerIsntBlockedByBlockedCallback()
|
||||
{
|
||||
int callbacks = 2;
|
||||
Barrier b = new Barrier(callbacks + 1);
|
||||
Timer t = null;
|
||||
t = new Timer(_ =>
|
||||
{
|
||||
if (Interlocked.Decrement(ref callbacks) >= 0)
|
||||
{
|
||||
Assert.True(b.SignalAndWait(MaxPositiveTimeoutInMs));
|
||||
}
|
||||
t.Dispose();
|
||||
}, null, -1, -1);
|
||||
t.Change(1, 50);
|
||||
|
||||
Assert.True(b.SignalAndWait(MaxPositiveTimeoutInMs));
|
||||
GC.KeepAlive(t);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ManyTimers_EachTimerDoesFire()
|
||||
{
|
||||
int maxTimers = 10000;
|
||||
CountdownEvent ce = new CountdownEvent(maxTimers);
|
||||
Timer[] timers = System.Linq.Enumerable.Range(0, maxTimers).Select(_ => new Timer(s => ce.Signal(), null, 100 /* enough time to wait on the are */, -1)).ToArray();
|
||||
try
|
||||
{
|
||||
Assert.True(ce.Wait(MaxPositiveTimeoutInMs), String.Format("Not all timers fired, {0} left of {1}", ce.CurrentCount, maxTimers));
|
||||
}
|
||||
finally
|
||||
{
|
||||
foreach (Timer t in timers)
|
||||
t.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
51
external/corefx/src/System.Threading.Timer/tests/TimerFiringTests.netstandard.cs
vendored
Normal file
51
external/corefx/src/System.Threading.Timer/tests/TimerFiringTests.netstandard.cs
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Xunit;
|
||||
|
||||
public partial class TimerFiringTests
|
||||
{
|
||||
[Fact]
|
||||
public void Timer_Constructor_CallbackOnly_Change()
|
||||
{
|
||||
var e = new ManualResetEvent(false);
|
||||
using (var t = new Timer(s => e.Set()))
|
||||
{
|
||||
t.Change(0u, 0u);
|
||||
Assert.True(e.WaitOne(MaxPositiveTimeoutInMs));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_Dispose_WaitHandle_Negative()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(() => new Timer(s => { }).Dispose(null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timer_Dispose_WaitHandle()
|
||||
{
|
||||
int tickCount = 0;
|
||||
var someTicksPending = new ManualResetEvent(false);
|
||||
var completeTicks = new ManualResetEvent(false);
|
||||
var allTicksCompleted = new ManualResetEvent(false);
|
||||
var t =
|
||||
new Timer(s =>
|
||||
{
|
||||
if (Interlocked.Increment(ref tickCount) == 2)
|
||||
someTicksPending.Set();
|
||||
Assert.True(completeTicks.WaitOne(MaxPositiveTimeoutInMs));
|
||||
Interlocked.Decrement(ref tickCount);
|
||||
}, null, 0, 1);
|
||||
Assert.True(someTicksPending.WaitOne(MaxPositiveTimeoutInMs));
|
||||
completeTicks.Set();
|
||||
t.Dispose(allTicksCompleted);
|
||||
Assert.True(allTicksCompleted.WaitOne(MaxPositiveTimeoutInMs));
|
||||
Assert.Equal(0, tickCount);
|
||||
Assert.Throws<ObjectDisposedException>(() => t.Change(0, 0));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user