├── .gitignore
├── .nuget
├── NuGet.Config
├── NuGet.exe
└── packages.config
├── Build
├── appveyor-deploy-docs.ps1
├── build.ps1
├── check-key.ps1
├── keys.ps1
├── keys
│ ├── Rackspace.Threading.dev.net35.snk
│ ├── Rackspace.Threading.dev.snk
│ ├── Rackspace.Threading.net35.snk
│ └── Rackspace.Threading.snk
├── push.ps1
└── version.ps1
├── Docs.Threading.History
├── 1.0
│ ├── Docs.Threading.1.0.shfbproj
│ └── packages.config
├── 1.1
│ ├── Docs.Threading.1.1.shfbproj
│ └── packages.config
├── 2.0
│ ├── Docs.Threading.2.0.shfbproj
│ └── packages.config
└── Current
│ ├── Docs.Threading.Current.shfbproj
│ └── packages.config
├── Docs.Threading
├── Content
│ ├── BreakingChangesPolicy.aml
│ ├── License.aml
│ ├── MSHelpViewerRoot.aml
│ ├── UserGuide
│ │ ├── Installation.aml
│ │ └── UserGuide.aml
│ └── Welcome.aml
├── Docs.Threading.net35-client.shfbproj
├── Docs.Threading.net40-client.shfbproj
├── Docs.Threading.net45.shfbproj
├── Docs.Threading.netcore45.shfbproj
├── Docs.Threading.portable-net40.shfbproj
├── Docs.Threading.portable-net45.shfbproj
└── Threading.content
├── LICENSE
├── PublicAPI
├── dotnet
│ ├── PublicAPI.Shipped.txt
│ └── PublicAPI.Unshipped.txt
├── net35-client
│ ├── PublicAPI.Shipped.txt
│ └── PublicAPI.Unshipped.txt
└── net40
│ ├── PublicAPI.Shipped.txt
│ └── PublicAPI.Unshipped.txt
├── README.md
├── Rackspace.Threading.sln
├── Rackspace.Threading
├── CancellationTokenSourceExtensions.cs
├── CompletedTask.cs
├── CoreTaskExtensions.cs
├── DelayedTask.cs
├── IAsyncDisposable.cs
├── IProgress`1.cs
├── Microsoft
│ └── Runtime
│ │ └── CompilerServices
│ │ ├── ConfiguredTaskAwaitable.cs
│ │ ├── ConfiguredTaskAwaitable`1.cs
│ │ ├── TaskAwaiter.cs
│ │ ├── TaskAwaiter`1.cs
│ │ └── YieldAwaitable.cs
├── NamespaceDoc.cs
├── ProgressChangedEventArgs`1.cs
├── Progress`1.cs
├── Properties
│ └── AssemblyInfo.cs
├── Rackspace.Threading.net35-client.csproj
├── Rackspace.Threading.net40-client.csproj
├── Rackspace.Threading.net45.csproj
├── Rackspace.Threading.netcore45.csproj
├── Rackspace.Threading.portable-net40.csproj
├── Rackspace.Threading.portable-net45.csproj
├── StreamExtensions.cs
├── System
│ ├── AwaitExtensions.cs
│ ├── ExecutionContextLightup.cs
│ ├── Lightup.cs
│ ├── LightupServices.cs
│ ├── LightupType.cs
│ └── Runtime
│ │ └── CompilerServices
│ │ ├── AsyncMethodBuilderCore.cs
│ │ ├── AsyncMethodTaskCache`1.cs
│ │ ├── AsyncServices.cs
│ │ ├── AsyncStateMachineAttribute.cs
│ │ ├── AsyncTaskMethodBuilder.cs
│ │ ├── AsyncTaskMethodBuilder`1.cs
│ │ ├── AsyncVoidMethodBuilder.cs
│ │ ├── IAsyncMethodBuilder.cs
│ │ ├── IAsyncStateMachine.cs
│ │ ├── ICriticalNotifyCompletion.cs
│ │ ├── INotifyCompletion.cs
│ │ ├── IteratorStateMachineAttribute.cs
│ │ └── StateMachineAttribute.cs
├── TaskBlocks.cs
├── TaskCompletionSourceExtensions.cs
├── TunnelVisionLabs.Threading.nuspec
├── VoidResult.cs
├── WebRequestExtensions.cs
├── packages.Rackspace.Threading.net35-client.config
├── packages.Rackspace.Threading.net40-client.config
├── packages.Rackspace.Threading.net45.config
├── packages.Rackspace.Threading.netcore45.config
├── packages.Rackspace.Threading.portable-net40.config
└── packages.Rackspace.Threading.portable-net45.config
├── Samples
└── CSharpSamples
│ ├── CSharpSamples.csproj
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── TaskBlockUsing.cs
│ ├── TaskBlockUsingWithResult.cs
│ ├── TaskBlockWhileAsync.cs
│ └── TaskBlockWhileAsyncCondition.cs
├── Tests
└── UnitTest.RackspaceThreading
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── TaskTestingBase.cs
│ ├── TestAsyncAwait.cs
│ ├── TestCancellationTokenSourceExtensions.cs
│ ├── TestCompletedTask.cs
│ ├── TestCoreTaskExtensions_Catch.cs
│ ├── TestCoreTaskExtensions_Finally.cs
│ ├── TestCoreTaskExtensions_Select.cs
│ ├── TestCoreTaskExtensions_Then.cs
│ ├── TestDelayedTask_Delay.cs
│ ├── TestDelayedTask_WhenAll.cs
│ ├── TestDelayedTask_WhenAny.cs
│ ├── TestProgress.cs
│ ├── TestStreamExtensions.cs
│ ├── TestTaskBlocks_Using.cs
│ ├── TestTaskBlocks_While.cs
│ ├── TestWebRequestExtensions.cs
│ ├── UnitTest.RackspaceThreading.net35-client.csproj
│ ├── UnitTest.RackspaceThreading.net40-client.csproj
│ ├── UnitTest.RackspaceThreading.net45.csproj
│ ├── UnitTest.RackspaceThreading.portable-net40.csproj
│ ├── UnitTest.RackspaceThreading.portable-net45.csproj
│ ├── packages.UnitTest.RackspaceThreading.net35-client.config
│ ├── packages.UnitTest.RackspaceThreading.net40-client.config
│ ├── packages.UnitTest.RackspaceThreading.net45.config
│ ├── packages.UnitTest.RackspaceThreading.portable-net40.config
│ └── packages.UnitTest.RackspaceThreading.portable-net45.config
├── TunnelVisionLabs.Threading.UnitTest.ruleset
├── TunnelVisionLabs.Threading.ruleset
├── appveyor.yml
└── stylecop.json
/.gitignore:
--------------------------------------------------------------------------------
1 | # NuGet Packages Folder
2 | /packages/
3 |
4 | # Build output
5 | obj/
6 | bin/
7 | Build/nuget/
8 |
9 | # Visual Studio per-user files
10 | *.suo
11 | *.user
12 | TestResults/
13 |
14 | # Roslyn IntelliSense Cache
15 | *.vs/
16 |
--------------------------------------------------------------------------------
/.nuget/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.nuget/NuGet.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tunnelvisionlabs/dotnet-threading/3e99a9d13476a1e8224d81f282f3cedad143c1bc/.nuget/NuGet.exe
--------------------------------------------------------------------------------
/.nuget/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Build/appveyor-deploy-docs.ps1:
--------------------------------------------------------------------------------
1 | param (
2 | [switch]$Debug
3 | )
4 |
5 | If ($Debug) {
6 | $BuildConfig = 'Debug'
7 | } Else {
8 | $BuildConfig = 'Release'
9 | }
10 |
11 | $DocsPath = "..\Docs.Threading\bin\Help\netcore45\$BuildConfig"
12 |
13 | # make sure the script was run from the expected path
14 | If (!(Test-Path $DocsPath)) {
15 | $host.ui.WriteErrorLine('The script was run from an invalid working directory.')
16 | Exit 1
17 | }
18 |
19 | function Upload-Folder() {
20 | param([string]$LocalPath, [string]$ArtifactName)
21 |
22 | [Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem')
23 | [System.IO.Compression.ZipFile]::CreateFromDirectory((Join-Path (pwd) $LocalPath), (Join-Path (pwd) $ArtifactName))
24 | Push-AppveyorArtifact (Join-Path (pwd) $ArtifactName)
25 | }
26 |
27 | Upload-Folder -LocalPath "$DocsPath" -ArtifactName "docs.zip"
28 |
--------------------------------------------------------------------------------
/Build/build.ps1:
--------------------------------------------------------------------------------
1 | param (
2 | [switch]$Debug,
3 | [string]$VisualStudioVersion = "14.0",
4 | [switch]$NoDocs,
5 | [string]$Verbosity = "minimal",
6 | [string]$Logger,
7 | [switch]$InstallSHFB
8 | )
9 |
10 | # build the solution
11 | $SolutionPath = "..\Rackspace.Threading.sln"
12 |
13 | # make sure the script was run from the expected path
14 | if (!(Test-Path $SolutionPath)) {
15 | $host.ui.WriteErrorLine('The script was run from an invalid working directory.')
16 | exit 1
17 | }
18 |
19 | . .\version.ps1
20 |
21 | If ($Debug) {
22 | $BuildConfig = 'Debug'
23 | } Else {
24 | $BuildConfig = 'Release'
25 | }
26 |
27 | If ($Version.Contains('-')) {
28 | $KeyConfiguration = 'Dev'
29 | } Else {
30 | $KeyConfiguration = 'Final'
31 | }
32 |
33 | If ($NoDocs -and -not $Debug) {
34 | $SolutionBuildConfig = $BuildConfig + 'NoDocs'
35 | } Else {
36 | $SolutionBuildConfig = $BuildConfig
37 | }
38 |
39 | # build the main project
40 | $nuget = '..\.nuget\NuGet.exe'
41 |
42 | if ($VisualStudioVersion -eq '4.0') {
43 | $msbuild = "$env:windir\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe"
44 | } Else {
45 | $msbuild = "${env:ProgramFiles(x86)}\MSBuild\$VisualStudioVersion\Bin\MSBuild.exe"
46 | }
47 |
48 | &$nuget 'restore' $SolutionPath
49 |
50 | If ($InstallSHFB) {
51 | # This is the NuGet package name for the SHFB package
52 | $SHFBPackageName = 'EWSoftware.SHFB'
53 | # This is the version according to the NuGet package itself
54 | $SHFBVersion = '2014.11.22.0'
55 |
56 | $SHFBPackagePath = "..\.shfb\$SHFBPackageName.$SHFBVersion.nupkg"
57 | If (-not (Test-Path $SHFBPackagePath)) {
58 | If (-not (Test-Path '..\.shfb')) {
59 | mkdir '..\.shfb'
60 | }
61 |
62 | # This is the release name on GitHub where the NuGet package is attached
63 | $SHFBRelease = 'v2014.11.22.0-beta'
64 |
65 | $SHFBInstallerSource = "https://github.com/tunnelvisionlabs/SHFB/releases/download/$SHFBRelease/$SHFBPackageName.$SHFBVersion.nupkg"
66 | Invoke-WebRequest $SHFBInstallerSource -OutFile $SHFBPackagePath
67 | If (-not $?) {
68 | $host.ui.WriteErrorLine('Failed to download the SHFB NuGet package')
69 | Exit $LASTEXITCODE
70 | }
71 | }
72 |
73 | $SHFBPackages = [System.IO.Path]::GetFullPath((Join-Path (pwd) '..\.shfb'))
74 | $SHFBPackagesUri = [System.Uri]$SHFBPackages
75 | Echo "$nuget 'install' 'EWSoftware.SHFB' -Version $SHFBVersion -OutputDirectory '..\packages' -Source $SHFBPackagesUri"
76 | &$nuget 'install' $SHFBPackageName -Version $SHFBVersion -OutputDirectory '..\packages' -Source $SHFBPackagesUri
77 | If (-not $?) {
78 | $host.ui.WriteErrorLine('Failed to install the SHFB NuGet package')
79 | Exit $LASTEXITCODE
80 | }
81 |
82 | $env:SHFBROOT = [System.IO.Path]::GetFullPath((Join-Path (pwd) "..\packages\$SHFBPackageName.$SHFBVersion\tools"))
83 | }
84 |
85 | If (-not $NoDocs) {
86 | If ((-not $env:SHFBROOT) -or (-not (Test-Path $env:SHFBROOT))) {
87 | $host.ui.WriteErrorLine('Could not locate Sandcastle Help File Builder')
88 | Exit 1
89 | }
90 | }
91 |
92 | If ($Logger) {
93 | $LoggerArgument = "/logger:$Logger"
94 | }
95 |
96 | &$msbuild '/nologo' '/m' '/nr:false' '/t:rebuild' $LoggerArgument "/verbosity:$Verbosity" "/p:Configuration=$SolutionBuildConfig" "/p:Platform=Any CPU" "/p:VisualStudioVersion=$VisualStudioVersion" "/p:KeyConfiguration=$KeyConfiguration" $SolutionPath
97 | if (-not $?) {
98 | $host.ui.WriteErrorLine('Build failed, aborting!')
99 | exit $LASTEXITCODE
100 | }
101 |
102 | # By default, do not create a NuGet package unless the expected strong name key files were used
103 | if (-not $SkipKeyCheck) {
104 | . .\keys.ps1
105 |
106 | foreach ($pair in $Keys.GetEnumerator()) {
107 | $assembly = Resolve-FullPath -Path "..\Rackspace.Threading\bin\$($pair.Key)\$BuildConfig\Rackspace.Threading.dll"
108 | # Run the actual check in a separate process or the current process will keep the assembly file locked
109 | powershell -Command ".\check-key.ps1 -Assembly '$assembly' -ExpectedKey '$($pair.Value)' -Build '$($pair.Key)'"
110 | if (-not $?) {
111 | Exit $LASTEXITCODE
112 | }
113 | }
114 | }
115 |
116 | if (-not (Test-Path 'nuget')) {
117 | mkdir "nuget"
118 | }
119 |
120 | # The NuGet packages reference XML documentation which is post-processed by SHFB. If the -NoDocs flag is specified,
121 | # these files are not created so packaging will fail.
122 | If (-not $NoDocs) {
123 | &$nuget 'pack' '..\Rackspace.Threading\TunnelVisionLabs.Threading.nuspec' '-OutputDirectory' 'nuget' '-Prop' "Configuration=$BuildConfig" '-Version' "$Version" '-Symbols'
124 | Exit $LASTEXITCODE
125 | }
126 |
--------------------------------------------------------------------------------
/Build/check-key.ps1:
--------------------------------------------------------------------------------
1 | param(
2 | [string]$Assembly,
3 | [string]$ExpectedKey,
4 | [string]$Build = $null
5 | )
6 |
7 | function Get-PublicKeyToken() {
8 | param([string]$assembly = $null)
9 | if ($assembly) {
10 | $bytes = $null
11 | $bytes = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($assembly).GetName().GetPublicKeyToken()
12 | if ($bytes) {
13 | $key = ""
14 | for ($i=0; $i -lt $bytes.Length; $i++) {
15 | $key += "{0:x2}" -f $bytes[$i]
16 | }
17 |
18 | $key
19 | }
20 | }
21 | }
22 |
23 | if (-not $Build) {
24 | $Build = $Assembly
25 | }
26 |
27 | $actual = Get-PublicKeyToken -assembly $Assembly
28 | if ($actual -ne $ExpectedKey) {
29 | $host.ui.WriteErrorLine("Invalid publicKeyToken for '$Build'; expected '$ExpectedKey' but found '$actual'")
30 | exit 1
31 | }
32 |
--------------------------------------------------------------------------------
/Build/keys.ps1:
--------------------------------------------------------------------------------
1 | # Note: these values may only change during major release
2 |
3 | If ($Version.Contains('-')) {
4 |
5 | # Use the development keys
6 | $Keys = @{
7 | 'net35-client' = 'bb62785d398726f0'
8 | 'net40-client' = '2c5e0ae13bddb49e'
9 | 'net45' = '2c5e0ae13bddb49e'
10 | 'netcore45' = '2c5e0ae13bddb49e'
11 | 'portable-net40' = '2c5e0ae13bddb49e'
12 | 'portable-net45' = '2c5e0ae13bddb49e'
13 | }
14 |
15 | } Else {
16 |
17 | # Use the final release keys
18 | $Keys = @{
19 | 'net35-client' = 'd693b28384d1c375'
20 | 'net40-client' = 'fd26f941b2df1ee3'
21 | 'net45' = 'fd26f941b2df1ee3'
22 | 'netcore45' = 'fd26f941b2df1ee3'
23 | 'portable-net40' = 'fd26f941b2df1ee3'
24 | 'portable-net45' = 'fd26f941b2df1ee3'
25 | }
26 |
27 | }
28 |
29 | function Resolve-FullPath() {
30 | param([string]$Path)
31 | [System.IO.Path]::GetFullPath((Join-Path (pwd) $Path))
32 | }
33 |
--------------------------------------------------------------------------------
/Build/keys/Rackspace.Threading.dev.net35.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tunnelvisionlabs/dotnet-threading/3e99a9d13476a1e8224d81f282f3cedad143c1bc/Build/keys/Rackspace.Threading.dev.net35.snk
--------------------------------------------------------------------------------
/Build/keys/Rackspace.Threading.dev.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tunnelvisionlabs/dotnet-threading/3e99a9d13476a1e8224d81f282f3cedad143c1bc/Build/keys/Rackspace.Threading.dev.snk
--------------------------------------------------------------------------------
/Build/keys/Rackspace.Threading.net35.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tunnelvisionlabs/dotnet-threading/3e99a9d13476a1e8224d81f282f3cedad143c1bc/Build/keys/Rackspace.Threading.net35.snk
--------------------------------------------------------------------------------
/Build/keys/Rackspace.Threading.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tunnelvisionlabs/dotnet-threading/3e99a9d13476a1e8224d81f282f3cedad143c1bc/Build/keys/Rackspace.Threading.snk
--------------------------------------------------------------------------------
/Build/push.ps1:
--------------------------------------------------------------------------------
1 | . .\version.ps1
2 |
3 | If ($Version.EndsWith('-dev')) {
4 | $host.ui.WriteErrorLine("Cannot push development version '$Version' to NuGet.")
5 | Exit 1
6 | }
7 |
8 | ..\.nuget\NuGet.exe 'push' ".\nuget\TunnelVisionLabs.Threading.$Version.nupkg"
9 |
--------------------------------------------------------------------------------
/Build/version.ps1:
--------------------------------------------------------------------------------
1 | $Version = "2.1.0-dev"
2 |
--------------------------------------------------------------------------------
/Docs.Threading.History/1.0/Docs.Threading.1.0.shfbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 | Debug
8 | AnyCPU
9 | 2.0
10 | {252da18a-bdb9-4d15-b5a9-63fa2b7f91a8}
11 | 1.9.9.0
12 |
14 | Docs.Threading
15 | Docs.Threading
16 | Docs.Threading.net45
17 |
18 | .NET Framework 3.5
19 | Threading API Reference
20 | en-US
21 |
22 |
23 |
24 |
25 | OnlyWarningsAndErrors
26 | Website
27 | True
28 | True
29 | False
30 | False
31 | True
32 | Standard
33 | Blank
34 | True
35 | VS2013
36 | False
37 | MemberName
38 | Threading API Reference
39 | AboveNamespaces
40 | API Reference
41 | Msdn
42 | Msdn
43 | True
44 | True
45 | Attributes, ExplicitInterfaceImplementations, InheritedMembers, InheritedFrameworkMembers, Protected, ProtectedInternalAsProtected, SealedProtected
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 | VisualStudio11
60 | -1
61 | 100
62 | 100
63 | -1
64 | Threading API
65 | Tunnel Vision Laboratories, LLC
66 | Id
67 | 100
68 | VS
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | <%3ba href="%3bhttps://github.com/tunnelvisionlabs/dotnet-threading"%3b>%3bThreading Library Home<%3b/a>%3b
80 | 2
81 | False
82 | ..\..\
83 |
84 |
87 |
88 | .\bin\Help\Debug\
89 |
90 |
91 | .\bin\Help\Release\
92 |
93 |
94 |
95 |
96 |
97 |
98 | ..\..\packages\TaskParallelLibrary.1.0.2856.0\lib\Net35\System.Threading.dll
99 | True
100 |
101 |
102 |
103 |
104 |
--------------------------------------------------------------------------------
/Docs.Threading.History/1.0/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Docs.Threading.History/1.1/Docs.Threading.1.1.shfbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 | Debug
8 | AnyCPU
9 | 2.0
10 | {665b3728-8eb8-491d-b685-5ff1cccde62e}
11 | 1.9.9.0
12 |
14 | Docs.Threading
15 | Docs.Threading
16 | Docs.Threading.net45
17 |
18 | .NET Framework 3.5
19 | Threading API Reference
20 | en-US
21 |
22 |
23 |
24 |
25 | OnlyWarningsAndErrors
26 | Website
27 | True
28 | True
29 | False
30 | False
31 | True
32 | Standard
33 | Blank
34 | True
35 | VS2013
36 | False
37 | MemberName
38 | Threading API Reference
39 | AboveNamespaces
40 | API Reference
41 | Msdn
42 | Msdn
43 | True
44 | True
45 | Attributes, ExplicitInterfaceImplementations, InheritedMembers, InheritedFrameworkMembers, Protected, ProtectedInternalAsProtected, SealedProtected
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 | VisualStudio11
60 | -1
61 | 100
62 | 100
63 | -1
64 | Threading API
65 | Tunnel Vision Laboratories, LLC
66 | Id
67 | 100
68 | VS
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | <%3ba href="%3bhttps://github.com/tunnelvisionlabs/dotnet-threading"%3b>%3bThreading Library Home<%3b/a>%3b
80 | 2
81 | False
82 | ..\..\
83 |
84 |
87 |
88 | .\bin\Help\Debug\
89 |
90 |
91 | .\bin\Help\Release\
92 |
93 |
94 |
95 |
96 |
97 |
98 | ..\..\packages\TaskParallelLibrary.1.0.2856.0\lib\Net35\System.Threading.dll
99 | True
100 |
101 |
102 |
103 |
104 |
--------------------------------------------------------------------------------
/Docs.Threading.History/1.1/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Docs.Threading.History/2.0/Docs.Threading.2.0.shfbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 | Debug
8 | AnyCPU
9 | 2.0
10 | {971275cf-04b4-4062-9487-516674838f48}
11 | 1.9.9.0
12 |
14 | Docs.Threading
15 | Docs.Threading
16 | Docs.Threading.net45
17 |
18 | .NET Framework 3.5
19 | Threading API Reference
20 | en-US
21 |
22 |
23 |
24 |
25 | OnlyWarningsAndErrors
26 | Website
27 | True
28 | True
29 | False
30 | False
31 | True
32 | Standard
33 | Blank
34 | True
35 | VS2013
36 | False
37 | MemberName
38 | Threading API Reference
39 | AboveNamespaces
40 | API Reference
41 | Msdn
42 | Msdn
43 | True
44 | True
45 | Attributes, ExplicitInterfaceImplementations, InheritedMembers, InheritedFrameworkMembers, Protected, ProtectedInternalAsProtected, SealedProtected
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 | VisualStudio11
60 | -1
61 | 100
62 | 100
63 | -1
64 | Threading API
65 | Tunnel Vision Laboratories, LLC
66 | Id
67 | 100
68 | VS
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | <%3ba href="%3bhttps://github.com/tunnelvisionlabs/dotnet-threading"%3b>%3bThreading Library Home<%3b/a>%3b
80 | 2
81 | False
82 | ..\..\
83 |
84 |
87 |
88 | .\bin\Help\Debug\
89 |
90 |
91 | .\bin\Help\Release\
92 |
93 |
94 |
95 |
96 |
97 |
98 | ..\..\packages\TaskParallelLibrary.1.0.2856.0\lib\Net35\System.Threading.dll
99 | True
100 |
101 |
102 |
103 |
104 |
--------------------------------------------------------------------------------
/Docs.Threading.History/2.0/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Docs.Threading.History/Current/Docs.Threading.Current.shfbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 | Debug
8 | AnyCPU
9 | 2.0
10 | {f6d21c32-671d-469e-b094-49794dff550f}
11 | 1.9.9.0
12 |
14 | Docs.Threading
15 | Docs.Threading
16 | Docs.Threading.net45
17 |
18 | .NET Framework 3.5
19 | Threading API Reference
20 | en-US
21 |
22 |
23 |
24 | OnlyWarningsAndErrors
25 | Website
26 | True
27 | True
28 | False
29 | False
30 | True
31 | Standard
32 | Blank
33 | True
34 | VS2013
35 | False
36 | MemberName
37 | Threading API Reference
38 | AboveNamespaces
39 | API Reference
40 | Msdn
41 | Msdn
42 | True
43 | True
44 | Attributes, ExplicitInterfaceImplementations, InheritedMembers, InheritedFrameworkMembers, Protected, ProtectedInternalAsProtected, SealedProtected
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | VisualStudio11
59 | -1
60 | 100
61 | 100
62 | -1
63 | Threading API
64 | Tunnel Vision Laboratories, LLC
65 | Id
66 | 100
67 | VS
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 | <%3ba href="%3bhttps://github.com/tunnelvisionlabs/dotnet-threading"%3b>%3bThreading Library Home<%3b/a>%3b
79 | 2
80 | False
81 | ..\..\
82 |
83 |
86 |
87 | .\bin\Help\Debug\
88 |
89 |
90 | .\bin\Help\Release\
91 |
92 |
93 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/Docs.Threading.History/Current/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Docs.Threading/Content/MSHelpViewerRoot.aml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Welcome to the Rackspace Threading API Reference
6 |
7 |
8 |
9 |
10 | Select a topic from the table of contents.
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Docs.Threading/Content/Welcome.aml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
9 | Welcome to the Rackspace Threading Library, a lightweight utility library designed to simplify
10 | the development of efficient, asynchronous code targeting .NET 3.5 and newer.
11 |
12 |
13 |
14 |
15 | Project Resources
16 |
17 |
18 | The following links go directly to the latest information available about the project.
19 |
20 |
21 |
22 |
23 |
24 | Getting Started:
25 |
26 |
27 |
28 |
29 | Latest Release:
30 | GitHub Releases
31 | Release notes for the latest release on GitHub
32 | https://github.com/tunnelvisionlabs/dotnet-threading/releases/latest
33 |
34 |
35 |
36 |
37 |
38 | Source Code:
39 | GitHub Repository
40 | Source code for the project on GitHub
41 | https://github.com/tunnelvisionlabs/dotnet-threading
42 |
43 |
44 |
45 |
46 |
47 | Documentation:
48 | API Documentation
49 | Documentation for the latest release hosted on GitHub Pages
50 | https://tunnelvisionlabs.github.io/dotnet-threading/docs-latest
51 |
52 |
53 |
54 |
55 |
56 | Issue Tracker:
57 | GitHub Issues
58 | Project issue tracker on GitHub Issues
59 | https://github.com/tunnelvisionlabs/dotnet-threading/issues
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/Docs.Threading/Docs.Threading.net35-client.shfbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 | Debug
8 | AnyCPU
9 | 2.0
10 | {a2d73067-50e8-42f8-aeb1-3b6bde900850}
11 | 1.9.9.0
12 |
14 | Docs.Threading
15 | Docs.Threading
16 | Docs.Threading.net35-client
17 |
18 | .NET Framework 3.5
19 | Threading API Reference
20 | en-US
21 |
22 |
23 |
24 | OnlyWarningsAndErrors
25 | Website
26 | True
27 | True
28 | False
29 | False
30 | True
31 | Standard
32 | Blank
33 | True
34 | VS2013
35 | False
36 | MemberName
37 | Threading API Reference
38 | AboveNamespaces
39 | API Reference
40 | Msdn
41 | Msdn
42 | True
43 | True
44 | Attributes, ExplicitInterfaceImplementations, InheritedMembers, InheritedFrameworkMembers, Protected, ProtectedInternalAsProtected, SealedProtected
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | VisualStudio11
59 | -1
60 | 100
61 | 100
62 | -1
63 | Threading API
64 | Tunnel Vision Laboratories, LLC
65 | Id
66 | 100
67 | VS
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 | <%3ba href="%3bhttps://github.com/tunnelvisionlabs/dotnet-threading"%3b>%3bThreading Library Home<%3b/a>%3b
82 | 2
83 | False
84 |
85 |
88 |
89 | .\bin\Help\net35-client\Debug\
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 | .\bin\Help\net35-client\Release\
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
--------------------------------------------------------------------------------
/Docs.Threading/Docs.Threading.net40-client.shfbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 | Debug
8 | AnyCPU
9 | 2.0
10 | {e0f959ce-80b6-4fac-bf98-fe04f0a09396}
11 | 1.9.9.0
12 |
14 | Docs.Threading
15 | Docs.Threading
16 | Docs.Threading.net40-client
17 |
18 | .NET Framework 4.0
19 | Threading API Reference
20 | en-US
21 |
22 |
23 |
24 | OnlyWarningsAndErrors
25 | Website
26 | True
27 | True
28 | False
29 | False
30 | True
31 | Standard
32 | Blank
33 | True
34 | VS2013
35 | False
36 | MemberName
37 | Threading API Reference
38 | AboveNamespaces
39 | API Reference
40 | Msdn
41 | Msdn
42 | True
43 | True
44 | Attributes, ExplicitInterfaceImplementations, InheritedMembers, InheritedFrameworkMembers, Protected, ProtectedInternalAsProtected, SealedProtected
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | VisualStudio11
59 | -1
60 | 100
61 | 100
62 | -1
63 | Threading API
64 | Tunnel Vision Laboratories, LLC
65 | Id
66 | 100
67 | VS
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 | <%3ba href="%3bhttps://github.com/tunnelvisionlabs/dotnet-threading"%3b>%3bThreading Library Home<%3b/a>%3b
95 | 2
96 | False
97 |
98 |
101 |
102 | .\bin\Help\net40-client\Debug\
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 | .\bin\Help\net40-client\Release\
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
--------------------------------------------------------------------------------
/Docs.Threading/Docs.Threading.net45.shfbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 | Debug
8 | AnyCPU
9 | 2.0
10 | {47b1188c-3aa9-470c-b8cb-244a028c2cdb}
11 | 1.9.9.0
12 |
14 | Docs.Threading
15 | Docs.Threading
16 | Docs.Threading.net45
17 |
18 | .NET Framework 4.5
19 | Threading API Reference
20 | en-US
21 |
22 |
23 |
24 | OnlyWarningsAndErrors
25 | Website
26 | True
27 | True
28 | False
29 | False
30 | True
31 | Standard
32 | Blank
33 | True
34 | VS2013
35 | False
36 | MemberName
37 | Threading API Reference
38 | AboveNamespaces
39 | API Reference
40 | Msdn
41 | Msdn
42 | True
43 | True
44 | Attributes, ExplicitInterfaceImplementations, InheritedMembers, InheritedFrameworkMembers, Protected, ProtectedInternalAsProtected, SealedProtected
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | VisualStudio11
59 | -1
60 | 100
61 | 100
62 | -1
63 | Threading API
64 | Tunnel Vision Laboratories, LLC
65 | Id
66 | 100
67 | VS
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 | <%3ba href="%3bhttps://github.com/tunnelvisionlabs/dotnet-threading"%3b>%3bThreading Library Home<%3b/a>%3b
90 | 2
91 | False
92 |
93 |
96 |
97 | .\bin\Help\net45\Debug\
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 | .\bin\Help\net45\Release\
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
--------------------------------------------------------------------------------
/Docs.Threading/Docs.Threading.portable-net40.shfbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 | Debug
8 | AnyCPU
9 | 2.0
10 | {e9efeccd-c484-4b4b-a6dd-8480570d1ee6}
11 | 1.9.9.0
12 |
14 | Docs.Threading
15 | Docs.Threading
16 | Docs.Threading.portable-net40
17 |
18 | .NET Portable Library 4.0 %28Legacy%29
19 | Threading API Reference
20 | en-US
21 |
22 |
23 |
24 | OnlyWarningsAndErrors
25 | Website
26 | True
27 | True
28 | False
29 | False
30 | True
31 | Standard
32 | Blank
33 | True
34 | VS2013
35 | False
36 | MemberName
37 | Threading API Reference
38 | AboveNamespaces
39 | API Reference
40 | Msdn
41 | Msdn
42 | True
43 | True
44 | Attributes, ExplicitInterfaceImplementations, InheritedMembers, InheritedFrameworkMembers, Protected, ProtectedInternalAsProtected, SealedProtected
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | VisualStudio11
59 | -1
60 | 100
61 | 100
62 | -1
63 | Threading API
64 | Tunnel Vision Laboratories, LLC
65 | Id
66 | 100
67 | VS
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 | <%3ba href="%3bhttps://github.com/tunnelvisionlabs/dotnet-threading"%3b>%3bThreading Library Home<%3b/a>%3b
95 | 2
96 | False
97 |
98 |
101 |
102 | .\bin\Help\portable-net40\Debug\
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 | .\bin\Help\portable-net40\Release\
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
--------------------------------------------------------------------------------
/Docs.Threading/Docs.Threading.portable-net45.shfbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 | Debug
8 | AnyCPU
9 | 2.0
10 | {70569826-141e-416d-b52b-edc9b5f4301b}
11 | 1.9.9.0
12 |
14 | Docs.Threading
15 | Docs.Threading
16 | Docs.Threading.portable-net45
17 |
18 | .NET Portable Library 4.5
19 | Threading API Reference
20 | en-US
21 |
22 |
23 |
24 | OnlyWarningsAndErrors
25 | Website
26 | True
27 | True
28 | False
29 | False
30 | True
31 | Standard
32 | Blank
33 | True
34 | VS2013
35 | False
36 | MemberName
37 | Threading API Reference
38 | AboveNamespaces
39 | API Reference
40 | Msdn
41 | Msdn
42 | True
43 | True
44 | Attributes, ExplicitInterfaceImplementations, InheritedMembers, InheritedFrameworkMembers, Protected, ProtectedInternalAsProtected, SealedProtected
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | VisualStudio11
59 | -1
60 | 100
61 | 100
62 | -1
63 | Threading API
64 | Tunnel Vision Laboratories, LLC
65 | Id
66 | 100
67 | VS
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 | <%3ba href="%3bhttps://github.com/tunnelvisionlabs/dotnet-threading"%3b>%3bThreading Library Home<%3b/a>%3b
90 | 2
91 | False
92 |
93 |
96 |
97 | .\bin\Help\portable-net45\Debug\
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 | .\bin\Help\portable-net45\Release\
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
--------------------------------------------------------------------------------
/Docs.Threading/Threading.content:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) Tunnel Vision Laboratories, LLC. All rights reserved.
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 | these files except in compliance with the License. You may obtain a copy of the
5 | License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software distributed
10 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11 | CONDITIONS OF ANY KIND, either express or implied. See the License for the
12 | specific language governing permissions and limitations under the License.
13 |
14 | ---
15 |
16 | This project uses other open source projects, which are used under the terms
17 | of the following license(s).
18 |
19 | Rackspace Threading Library
20 |
21 | Copyright (c) Rackspace, US Inc. All rights reserved.
22 |
23 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use
24 | these files except in compliance with the License. You may obtain a copy of the
25 | License at
26 |
27 | http://www.apache.org/licenses/LICENSE-2.0
28 |
29 | Unless required by applicable law or agreed to in writing, software distributed
30 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
31 | CONDITIONS OF ANY KIND, either express or implied. See the License for the
32 | specific language governing permissions and limitations under the License.
33 |
34 | Microsoft .NET Reference Source
35 |
36 | Copyright (c) Microsoft Corporation
37 |
38 | Permission is hereby granted, free of charge, to any person obtaining a copy
39 | of this software and associated documentation files (the "Software"), to deal
40 | in the Software without restriction, including without limitation the rights
41 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
42 | copies of the Software, and to permit persons to whom the Software is
43 | furnished to do so, subject to the following conditions:
44 |
45 | The above copyright notice and this permission notice shall be included in all
46 | copies or substantial portions of the Software.
47 |
48 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
49 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
50 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
51 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
52 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
53 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
54 | SOFTWARE.
55 |
--------------------------------------------------------------------------------
/PublicAPI/dotnet/PublicAPI.Unshipped.txt:
--------------------------------------------------------------------------------
1 | AwaitExtensions
2 | Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable
3 | Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter
4 | Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult() -> void
5 | Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.IsCompleted.get -> bool
6 | Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.OnCompleted(System.Action continuation) -> void
7 | Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.UnsafeOnCompleted(System.Action continuation) -> void
8 | Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable.GetAwaiter() -> Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter
9 | Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable
10 | Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter
11 | Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult() -> TResult
12 | Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.IsCompleted.get -> bool
13 | Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.OnCompleted(System.Action continuation) -> void
14 | Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.UnsafeOnCompleted(System.Action continuation) -> void
15 | Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable.GetAwaiter() -> Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter
16 | Microsoft.Runtime.CompilerServices.TaskAwaiter
17 | Microsoft.Runtime.CompilerServices.TaskAwaiter.GetResult() -> void
18 | Microsoft.Runtime.CompilerServices.TaskAwaiter.IsCompleted.get -> bool
19 | Microsoft.Runtime.CompilerServices.TaskAwaiter.OnCompleted(System.Action continuation) -> void
20 | Microsoft.Runtime.CompilerServices.TaskAwaiter.UnsafeOnCompleted(System.Action continuation) -> void
21 | Microsoft.Runtime.CompilerServices.TaskAwaiter
22 | Microsoft.Runtime.CompilerServices.TaskAwaiter.GetResult() -> TResult
23 | Microsoft.Runtime.CompilerServices.TaskAwaiter.IsCompleted.get -> bool
24 | Microsoft.Runtime.CompilerServices.TaskAwaiter.OnCompleted(System.Action continuation) -> void
25 | Microsoft.Runtime.CompilerServices.TaskAwaiter.UnsafeOnCompleted(System.Action continuation) -> void
26 | Microsoft.Runtime.CompilerServices.YieldAwaitable
27 | Microsoft.Runtime.CompilerServices.YieldAwaitable.GetAwaiter() -> Microsoft.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter
28 | Microsoft.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter
29 | Microsoft.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.GetResult() -> void
30 | Microsoft.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.IsCompleted.get -> bool
31 | Microsoft.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.OnCompleted(System.Action continuation) -> void
32 | Microsoft.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.UnsafeOnCompleted(System.Action continuation) -> void
33 | static AwaitExtensions.ConfigureAwait(this System.Threading.Tasks.Task task, bool continueOnCapturedContext) -> Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable
34 | static AwaitExtensions.ConfigureAwait(this System.Threading.Tasks.Task task, bool continueOnCapturedContext) -> Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable
35 | static AwaitExtensions.GetAwaiter(this System.Threading.Tasks.Task task) -> Microsoft.Runtime.CompilerServices.TaskAwaiter
36 | static AwaitExtensions.GetAwaiter(this System.Threading.Tasks.Task task) -> Microsoft.Runtime.CompilerServices.TaskAwaiter
37 | static Rackspace.Threading.CoreTaskExtensions.Catch(this System.Threading.Tasks.Task task, System.Predicate filter, System.Func, TException, System.Threading.Tasks.Task> handler) -> System.Threading.Tasks.Task
38 | static Rackspace.Threading.CoreTaskExtensions.Catch(this System.Threading.Tasks.Task task, System.Predicate filter, System.Func, TException, TResult> handler) -> System.Threading.Tasks.Task
39 | static Rackspace.Threading.CoreTaskExtensions.Catch(this System.Threading.Tasks.Task task, System.Predicate filter, System.Action handler) -> System.Threading.Tasks.Task
40 | static Rackspace.Threading.CoreTaskExtensions.Catch(this System.Threading.Tasks.Task task, System.Predicate filter, System.Func handler) -> System.Threading.Tasks.Task
41 | static Rackspace.Threading.DelayedTask.Yield() -> Microsoft.Runtime.CompilerServices.YieldAwaitable
--------------------------------------------------------------------------------
/PublicAPI/net40/PublicAPI.Unshipped.txt:
--------------------------------------------------------------------------------
1 | static Rackspace.Threading.CoreTaskExtensions.Catch(this System.Threading.Tasks.Task task, System.Predicate filter, System.Func, TException, System.Threading.Tasks.Task> handler) -> System.Threading.Tasks.Task
2 | static Rackspace.Threading.CoreTaskExtensions.Catch(this System.Threading.Tasks.Task task, System.Predicate filter, System.Func, TException, TResult> handler) -> System.Threading.Tasks.Task
3 | static Rackspace.Threading.CoreTaskExtensions.Catch(this System.Threading.Tasks.Task task, System.Predicate filter, System.Action handler) -> System.Threading.Tasks.Task
4 | static Rackspace.Threading.CoreTaskExtensions.Catch(this System.Threading.Tasks.Task task, System.Predicate filter, System.Func handler) -> System.Threading.Tasks.Task
5 | static Rackspace.Threading.DelayedTask.Yield() -> Microsoft.Runtime.CompilerServices.YieldAwaitable
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Threading Library for .NET
2 |
3 | [](https://gitter.im/tunnelvisionlabs/dotnet-threading?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4 |
5 | [](https://ci.appveyor.com/project/sharwell/dotnet-threading/branch/master)
6 |
7 | [](https://codecov.io/github/tunnelvisionlabs/dotnet-threading?branch=master)
8 |
9 | This library provides utility classes to simplify writing asynchronous code targeting .NET 3.5 and newer.
10 |
--------------------------------------------------------------------------------
/Rackspace.Threading/CompletedTask.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3 |
4 | namespace Rackspace.Threading
5 | {
6 | using System.Threading.Tasks;
7 |
8 | ///
9 | /// Provides static methods to create completed and instances.
10 | ///
11 | ///
12 | public static class CompletedTask
13 | {
14 | ///
15 | /// Gets a completed .
16 | ///
17 | /// A completed .
18 | public static Task Default
19 | {
20 | get
21 | {
22 | return FromResult(default(VoidResult));
23 | }
24 | }
25 |
26 | ///
27 | /// Gets a completed with the specified result.
28 | ///
29 | /// The task result type.
30 | /// The result of the completed task.
31 | /// A completed , whose property returns the specified .
32 | public static Task FromResult(TResult result)
33 | {
34 | #if NET45PLUS
35 | return Task.FromResult(result);
36 | #else
37 | TaskCompletionSource completionSource = new TaskCompletionSource();
38 | completionSource.SetResult(result);
39 | return completionSource.Task;
40 | #endif
41 | }
42 |
43 | ///
44 | /// Gets a canceled .
45 | ///
46 | /// A canceled .
47 | public static Task Canceled()
48 | {
49 | return Canceled();
50 | }
51 |
52 | ///
53 | /// Gets a canceled .
54 | ///
55 | /// The task result type.
56 | /// A canceled .
57 | public static Task Canceled()
58 | {
59 | TaskCompletionSource completionSource = new TaskCompletionSource();
60 | completionSource.SetCanceled();
61 | return completionSource.Task;
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/Rackspace.Threading/IAsyncDisposable.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3 |
4 | namespace Rackspace.Threading
5 | {
6 | using System;
7 | using System.Threading.Tasks;
8 |
9 | ///
10 | /// Provides a mechanism for asynchronously releasing unmanaged resources.
11 | ///
12 | public interface IAsyncDisposable : IDisposable
13 | {
14 | ///
15 | /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
16 | ///
17 | ///
18 | /// This method should perform the same operation as , with the following
19 | /// key differences.
20 | ///
21 | /// - The method should never be called from a finalizer.
22 | /// - The method will not be called automatically from a using block,
23 | /// even when that block is located within an method. The
24 | /// methods provide support for the
25 | /// interface in a manner resembling the behavior proposed in
26 | /// IAsyncDisposable, using statements, and async/await.
27 | ///
28 | ///
29 | /// To prevent finalization of the object while an asynchronous dispose operation is ongoing,
30 | /// the returned by this method should retain a reference to the object
31 | /// until the operation is complete.
32 | ///
33 | ///
34 | /// A representing the asynchronous operation.
35 | Task DisposeAsync();
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Rackspace.Threading/IProgress`1.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3 |
4 | #if NET40PLUS
5 |
6 | using System;
7 | using System.Runtime.CompilerServices;
8 |
9 | [assembly: TypeForwardedTo(typeof(IProgress<>))]
10 |
11 | #else
12 |
13 | namespace System
14 | {
15 | ///
16 | /// Defines a provider for progress updates.
17 | ///
18 | /// The type of progress update value.
19 | public interface IProgress
20 | {
21 | ///
22 | /// Reports a progress update.
23 | ///
24 | /// The value of the updated progress.
25 | void Report(T value);
26 | }
27 | }
28 |
29 | #endif
30 |
--------------------------------------------------------------------------------
/Rackspace.Threading/Microsoft/Runtime/CompilerServices/ConfiguredTaskAwaitable.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3 |
4 | #if NET40PLUS && !NET45PLUS
5 |
6 | [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable))]
7 |
8 | #else
9 |
10 | // NOTE: The reason this type does exist in the BCL System.Threading.Tasks contract is because we need to be able to
11 | // construct one of these in the AwaitExtensions class. The equivalent type in the current platform does not have an
12 | // accessible constructor, hence the AwaitExtensions would fail when run on platforms where System.Threading.Tasks gets
13 | // unified.
14 | namespace Microsoft.Runtime.CompilerServices
15 | {
16 | using System;
17 | using System.Diagnostics;
18 | using System.Runtime.CompilerServices;
19 | using System.Threading.Tasks;
20 |
21 | /// Provides an awaitable object that allows for configured awaits on .
22 | /// This type is intended for compiler use only.
23 | ///
24 | public struct ConfiguredTaskAwaitable
25 | {
26 | /// The task being awaited.
27 | private readonly ConfiguredTaskAwaiter _configuredTaskAwaiter;
28 |
29 | /// Initializes a new instance of the struct.
30 | /// The awaitable .
31 | ///
32 | /// to attempt to marshal the continuation back to the original context captured;
33 | /// otherwise, .
34 | ///
35 | internal ConfiguredTaskAwaitable(Task task, bool continueOnCapturedContext)
36 | {
37 | Debug.Assert(task != null, "Assertion failed: task != null");
38 | _configuredTaskAwaiter = new ConfiguredTaskAwaiter(task, continueOnCapturedContext);
39 | }
40 |
41 | /// Gets an awaiter for this awaitable.
42 | /// The awaiter.
43 | public ConfiguredTaskAwaiter GetAwaiter()
44 | {
45 | return _configuredTaskAwaiter;
46 | }
47 |
48 | /// Provides an awaiter for a .
49 | /// This type is intended for compiler use only.
50 | public struct ConfiguredTaskAwaiter : ICriticalNotifyCompletion, INotifyCompletion
51 | {
52 | /// The task being awaited.
53 | private readonly Task _task;
54 |
55 | /// Whether to attempt marshaling back to the original context.
56 | private readonly bool _continueOnCapturedContext;
57 |
58 | /// Initializes a new instance of the struct.
59 | /// The to await.
60 | ///
61 | /// to attempt to marshal the continuation back to the original context captured;
62 | /// otherwise, .
63 | ///
64 | internal ConfiguredTaskAwaiter(Task task, bool continueOnCapturedContext)
65 | {
66 | Debug.Assert(task != null, "Assertion failed: task != null");
67 | _task = task;
68 | _continueOnCapturedContext = continueOnCapturedContext;
69 | }
70 |
71 | /// Gets a value indicating whether the task being awaited is completed.
72 | /// This property is intended for compiler user rather than use directly in code.
73 | ///
74 | /// if the task being awaited is completed; otherwise, .
75 | ///
76 | /// The awaiter was not properly initialized.
77 | public bool IsCompleted
78 | {
79 | get
80 | {
81 | return _task.IsCompleted;
82 | }
83 | }
84 |
85 | ///
86 | /// Schedules the continuation onto the associated with this .
87 | ///
88 | /// The action to invoke when the await operation completes.
89 | ///
90 | /// If is .
91 | ///
92 | /// The awaiter was not properly initialized.
93 | /// This method is intended for compiler user rather than use directly in code.
94 | public void OnCompleted(Action continuation)
95 | {
96 | TaskAwaiter.OnCompletedInternal(_task, continuation, _continueOnCapturedContext);
97 | }
98 |
99 | ///
100 | /// Schedules the continuation onto the associated with this .
101 | ///
102 | /// The action to invoke when the await operation completes.
103 | ///
104 | /// If is .
105 | ///
106 | /// The awaiter was not properly initialized.
107 | /// This method is intended for compiler user rather than use directly in code.
108 | #if !SILVERLIGHT
109 | //// [SecurityCritical]
110 | #endif
111 | public void UnsafeOnCompleted(Action continuation)
112 | {
113 | TaskAwaiter.OnCompletedInternal(_task, continuation, _continueOnCapturedContext);
114 | }
115 |
116 | /// Ends the await on the completed .
117 | /// The awaiter was not properly initialized.
118 | /// The task was not yet completed.
119 | /// The task was canceled.
120 | /// The task completed in a state.
121 | public void GetResult()
122 | {
123 | TaskAwaiter.ValidateEnd(_task);
124 | }
125 | }
126 | }
127 | }
128 |
129 | #endif
130 |
--------------------------------------------------------------------------------
/Rackspace.Threading/Microsoft/Runtime/CompilerServices/ConfiguredTaskAwaitable`1.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3 |
4 | #if NET40PLUS && !NET45PLUS
5 |
6 | [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable<>))]
7 |
8 | #else
9 |
10 | // NOTE: The reason this type does exist in the BCL System.Threading.Tasks contract is because we need to be able to
11 | // construct one of these in the AwaitExtensions class. The equivalent type in the current platform does not have an
12 | // accessible constructor, hence the AwaitExtensions would fail when run on platforms where System.Threading.Tasks gets
13 | // unified.
14 | namespace Microsoft.Runtime.CompilerServices
15 | {
16 | using System;
17 | using System.Diagnostics;
18 | using System.Runtime.CompilerServices;
19 | using System.Threading.Tasks;
20 |
21 | ///
22 | /// Provides an awaitable object that allows for configured awaits on .
23 | ///
24 | /// This type is intended for compiler use only.
25 | /// The result type of the .
26 | ///
27 | public struct ConfiguredTaskAwaitable
28 | {
29 | /// The underlying awaitable on whose logic this awaitable relies.
30 | private readonly ConfiguredTaskAwaiter _configuredTaskAwaiter;
31 |
32 | /// Initializes a new instance of the struct.
33 | /// The awaitable .
34 | ///
35 | /// to attempt to marshal the continuation back to the original context captured;
36 | /// otherwise, .
37 | ///
38 | internal ConfiguredTaskAwaitable(Task task, bool continueOnCapturedContext)
39 | {
40 | _configuredTaskAwaiter = new ConfiguredTaskAwaiter(task, continueOnCapturedContext);
41 | }
42 |
43 | /// Gets an awaiter for this awaitable.
44 | /// The awaiter.
45 | public ConfiguredTaskAwaiter GetAwaiter()
46 | {
47 | return _configuredTaskAwaiter;
48 | }
49 |
50 | /// Provides an awaiter for a .
51 | /// This type is intended for compiler use only.
52 | public struct ConfiguredTaskAwaiter : ICriticalNotifyCompletion
53 | {
54 | /// The task being awaited.
55 | private readonly Task _task;
56 |
57 | /// Whether to attempt marshaling back to the original context.
58 | private readonly bool _continueOnCapturedContext;
59 |
60 | /// Initializes a new instance of the struct.
61 | /// The awaitable .
62 | ///
63 | /// to attempt to marshal the continuation back to the original context captured;
64 | /// otherwise, .
65 | ///
66 | internal ConfiguredTaskAwaiter(Task task, bool continueOnCapturedContext)
67 | {
68 | Debug.Assert(task != null, "Assertion failed: task != null");
69 | _task = task;
70 | _continueOnCapturedContext = continueOnCapturedContext;
71 | }
72 |
73 | /// Gets a value indicating whether the task being awaited is completed.
74 | /// This property is intended for compiler user rather than use directly in code.
75 | ///
76 | /// if the task being awaited is completed; otherwise, .
77 | ///
78 | /// The awaiter was not properly initialized.
79 | public bool IsCompleted
80 | {
81 | get
82 | {
83 | return _task.IsCompleted;
84 | }
85 | }
86 |
87 | ///
88 | /// Schedules the continuation onto the associated with this .
89 | ///
90 | /// The action to invoke when the await operation completes.
91 | ///
92 | /// If is .
93 | ///
94 | /// The awaiter was not properly initialized.
95 | /// This method is intended for compiler user rather than use directly in code.
96 | public void OnCompleted(Action continuation)
97 | {
98 | TaskAwaiter.OnCompletedInternal(_task, continuation, _continueOnCapturedContext);
99 | }
100 |
101 | ///
102 | /// Schedules the continuation onto the associated with this .
103 | ///
104 | /// The action to invoke when the await operation completes.
105 | ///
106 | /// If is .
107 | ///
108 | /// The awaiter was not properly initialized.
109 | /// This method is intended for compiler user rather than use directly in code.
110 | #if !SILVERLIGHT
111 | //// [SecurityCritical]
112 | #endif
113 | public void UnsafeOnCompleted(Action continuation)
114 | {
115 | TaskAwaiter.OnCompletedInternal(_task, continuation, _continueOnCapturedContext);
116 | }
117 |
118 | /// Ends the await on the completed .
119 | /// The result of the completed .
120 | /// The awaiter was not properly initialized.
121 | /// The task was not yet completed.
122 | /// The task was canceled.
123 | /// The task completed in a state.
124 | public TResult GetResult()
125 | {
126 | TaskAwaiter.ValidateEnd(_task);
127 | return _task.Result;
128 | }
129 | }
130 | }
131 | }
132 |
133 | #endif
134 |
--------------------------------------------------------------------------------
/Rackspace.Threading/Microsoft/Runtime/CompilerServices/TaskAwaiter`1.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3 |
4 | #if NET40PLUS && !NET45PLUS
5 |
6 | [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.Runtime.CompilerServices.TaskAwaiter<>))]
7 |
8 | #else
9 |
10 | // NOTE: The reason this type does exist in the BCL System.Threading.Tasks contract is because we need to be able to
11 | // construct one of these in the AwaitExtensions class. The equivalent type in the current platform does not have an
12 | // accessible constructor, hence the AwaitExtensions would fail when run on platforms where System.Threading.Tasks gets
13 | // unified.
14 | namespace Microsoft.Runtime.CompilerServices
15 | {
16 | using System;
17 | using System.Diagnostics;
18 | using System.Runtime.CompilerServices;
19 | using System.Threading.Tasks;
20 |
21 | /// Provides an awaiter for awaiting a .
22 | /// This type is intended for compiler use only.
23 | /// The return type of the .
24 | ///
25 | public struct TaskAwaiter : ICriticalNotifyCompletion, INotifyCompletion
26 | {
27 | /// The task being awaited.
28 | private readonly Task _task;
29 |
30 | /// Initializes a new instance of the struct.
31 | /// The to be awaited.
32 | internal TaskAwaiter(Task task)
33 | {
34 | Debug.Assert(task != null, "Assertion failed: task != null");
35 | _task = task;
36 | }
37 |
38 | /// Gets a value indicating whether the task being awaited is completed.
39 | /// This property is intended for compiler user rather than use directly in code.
40 | ///
41 | /// if the task being awaited is completed; otherwise, .
42 | ///
43 | /// The awaiter was not properly initialized.
44 | public bool IsCompleted
45 | {
46 | get
47 | {
48 | return _task.IsCompleted;
49 | }
50 | }
51 |
52 | ///
53 | /// Schedules the continuation onto the associated with this
54 | /// .
55 | ///
56 | /// The action to invoke when the await operation completes.
57 | ///
58 | /// If is .
59 | ///
60 | /// The awaiter was not properly initialized.
61 | /// This method is intended for compiler user rather than use directly in code.
62 | public void OnCompleted(Action continuation)
63 | {
64 | TaskAwaiter.OnCompletedInternal(_task, continuation, TaskAwaiter.ContinueOnCapturedContextDefault);
65 | }
66 |
67 | ///
68 | /// Schedules the continuation onto the associated with this
69 | /// .
70 | ///
71 | /// The action to invoke when the await operation completes.
72 | ///
73 | /// If is .
74 | ///
75 | /// The awaiter was not properly initialized.
76 | /// This method is intended for compiler user rather than use directly in code.
77 | #if !SILVERLIGHT
78 | ////[SecurityCritical]
79 | #endif
80 | public void UnsafeOnCompleted(Action continuation)
81 | {
82 | TaskAwaiter.OnCompletedInternal(_task, continuation, TaskAwaiter.ContinueOnCapturedContextDefault);
83 | }
84 |
85 | /// Ends the await on the completed .
86 | /// The result of the completed .
87 | /// The awaiter was not properly initialized.
88 | /// The task was not yet completed.
89 | /// The task was canceled.
90 | /// The task completed in a state.
91 | public TResult GetResult()
92 | {
93 | TaskAwaiter.ValidateEnd(_task);
94 | return _task.Result;
95 | }
96 | }
97 | }
98 |
99 | #endif
100 |
--------------------------------------------------------------------------------
/Rackspace.Threading/Microsoft/Runtime/CompilerServices/YieldAwaitable.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3 |
4 | #if NET40PLUS && !NET45PLUS
5 |
6 | [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.Runtime.CompilerServices.YieldAwaitable))]
7 |
8 | #else
9 |
10 | // NOTE: The reason this type does exist in the BCL System.Threading.Tasks contract is because we need to be able to
11 | // construct one of these in the AwaitExtensions class. The equivalent type in the current platform does not have an
12 | // accessible constructor, hence the AwaitExtensions would fail when run on platforms where System.Threading.Tasks gets
13 | // unified.
14 | namespace Microsoft.Runtime.CompilerServices
15 | {
16 | using System;
17 | using System.Runtime.CompilerServices;
18 | using System.Threading.Tasks;
19 | using Rackspace.Threading;
20 |
21 | /// Provides an awaitable context for switching into a target environment.
22 | /// This type is intended for compiler use only.
23 | ///
24 | public struct YieldAwaitable
25 | {
26 | /// Gets an awaiter for this .
27 | /// An awaiter for this awaitable.
28 | /// This method is intended for compiler user rather than use directly in code.
29 | public YieldAwaiter GetAwaiter()
30 | {
31 | // if not initialized properly, m_target will just be null
32 | return default(YieldAwaiter);
33 | }
34 |
35 | /// Provides an awaiter that switches into a target environment.
36 | /// This type is intended for compiler use only.
37 | public struct YieldAwaiter : ICriticalNotifyCompletion, INotifyCompletion
38 | {
39 | /// A completed task.
40 | private static readonly Task _completed = CompletedTask.FromResult(0);
41 |
42 | /// Gets a value indicating whether a yield is not required.
43 | /// This property is intended for compiler user rather than use directly in code.
44 | /// A value indicating whether a yield is not required.
45 | public bool IsCompleted
46 | {
47 | get
48 | {
49 | // yielding is always required for YieldAwaiter, hence false
50 | return false;
51 | }
52 | }
53 |
54 | /// Posts the back to the current context.
55 | /// The action to invoke asynchronously.
56 | /// The awaiter was not properly initialized.
57 | public void OnCompleted(Action continuation)
58 | {
59 | _completed.GetAwaiter().OnCompleted(continuation);
60 | }
61 |
62 | /// Posts the back to the current context.
63 | /// The action to invoke asynchronously.
64 | /// The awaiter was not properly initialized.
65 | ////[SecurityCritical]
66 | public void UnsafeOnCompleted(Action continuation)
67 | {
68 | _completed.GetAwaiter().UnsafeOnCompleted(continuation);
69 | }
70 |
71 | /// Ends the await operation.
72 | public void GetResult()
73 | {
74 | // NOP. It exists purely because the compiler pattern demands it.
75 | }
76 | }
77 | }
78 | }
79 |
80 | #endif
81 |
--------------------------------------------------------------------------------
/Rackspace.Threading/NamespaceDoc.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3 |
4 | namespace Rackspace.Threading
5 | {
6 | using System.Runtime.CompilerServices;
7 |
8 | ///
9 | /// The namespace contains classes for simplifying the
10 | /// development of asynchronous code which supports .NET 3.5 and newer, without relying
11 | /// on .
12 | ///
13 | [CompilerGenerated]
14 | internal class NamespaceDoc
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Rackspace.Threading/ProgressChangedEventArgs`1.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3 |
4 | namespace Rackspace.Threading
5 | {
6 | using System;
7 |
8 | ///
9 | /// This class contains information for the event.
10 | ///
11 | ///
12 | /// Prior to .NET 4.5, the delegate included a
13 | /// constraint that the generic argument be derived from . This
14 | /// constraint prevents a direct back-port of the
15 | /// class to earlier frameworks, so the class is provided with
16 | /// a wrapper around the progress value reported by the
17 | /// event.
18 | ///
19 | /// The type representing the progress indicator.
20 | ///
21 | public class ProgressChangedEventArgs : EventArgs
22 | {
23 | ///
24 | /// This is the backing field for the property.
25 | ///
26 | private readonly T _progress;
27 |
28 | ///
29 | /// Initializes a new instance of the class
30 | /// with the specified progress.
31 | ///
32 | /// An instance of representing the current progress.
33 | public ProgressChangedEventArgs(T progress)
34 | {
35 | _progress = progress;
36 | }
37 |
38 | ///
39 | /// Gets the current progress.
40 | ///
41 | ///
42 | /// An instance of representing the current progress.
43 | ///
44 | public T Progress
45 | {
46 | get
47 | {
48 | return _progress;
49 | }
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Rackspace.Threading/Progress`1.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3 |
4 | namespace Rackspace.Threading
5 | {
6 | using System;
7 | using System.Threading;
8 |
9 | ///
10 | /// Provides an that invokes callbacks for each reported progress value.
11 | ///
12 | ///
13 | /// Any handler provided to the constructor or event handlers registered with the
14 | /// event are invoked through a
15 | /// instance captured when the instance is constructed. If there is no current
16 | /// at the time of construction, the callbacks will be invoked
17 | /// on the .
18 | ///
19 | /// Specifies the type of the progress report value.
20 | public class Progress : IProgress
21 | {
22 | private static readonly SynchronizationContext DefaultSynchronizationContext = new SynchronizationContext();
23 |
24 | private readonly SynchronizationContext _synchronizationContext;
25 | private readonly SendOrPostCallback _callback;
26 | private readonly Action _handler;
27 |
28 | ///
29 | /// Initializes a new instance of the class.
30 | ///
31 | public Progress()
32 | {
33 | _synchronizationContext = SynchronizationContext.Current ?? DefaultSynchronizationContext;
34 | _callback = Callback;
35 | }
36 |
37 | ///
38 | /// Initializes a new instance of the class with the specified callback.
39 | ///
40 | ///
41 | /// A handler to invoke for each reported progress value. This handler will be invoked in addition
42 | /// to any delegates registered with the event. Depending on the
43 | /// instance captured by the at
44 | /// construction, it is possible that this handler instance could be invoked concurrently with
45 | /// itself.
46 | ///
47 | public Progress(Action handler)
48 | : this()
49 | {
50 | _handler = handler;
51 | }
52 |
53 | ///
54 | /// Raised for each reported progress value.
55 | ///
56 | ///
57 | /// Handlers registered with this event will be invoked on the
58 | /// captured when the instance was constructed.
59 | ///
60 | public event EventHandler> ProgressChanged;
61 |
62 | ///
63 | ///
64 | /// Any handler provided to the constructor or event handlers registered with the
65 | /// event are invoked through a
66 | /// instance captured when the instance is constructed. If there is no current
67 | /// at the time of construction, the callbacks will be invoked
68 | /// on the .
69 | ///
70 | void IProgress.Report(T value)
71 | {
72 | OnReport(value);
73 | }
74 |
75 | ///
76 | /// Reports a progress change.
77 | ///
78 | /// The value of the updated progress.
79 | protected virtual void OnReport(T value)
80 | {
81 | if (_handler != null || ProgressChanged != null)
82 | _synchronizationContext.Post(_callback, value);
83 | }
84 |
85 | private void Callback(object state)
86 | {
87 | T value = (T)state;
88 | if (_handler != null)
89 | _handler(value);
90 |
91 | EventHandler> t = ProgressChanged;
92 | if (t != null)
93 | t(this, new ProgressChangedEventArgs(value));
94 | }
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/Rackspace.Threading/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3 |
4 | using System;
5 | using System.Reflection;
6 | using System.Runtime.InteropServices;
7 |
8 | // General Information about an assembly is controlled through the following
9 | // set of attributes. Change these attribute values to modify the information
10 | // associated with an assembly.
11 | [assembly: AssemblyTitle("Rackspace.Threading")]
12 | [assembly: AssemblyDescription("Utility library to simplify writing asynchronous code which supports .NET 3.5 and newer")]
13 | [assembly: AssemblyConfiguration("")]
14 | [assembly: AssemblyCompany("Tunnel Vision Laboratories, LLC")]
15 | [assembly: AssemblyProduct("TunnelVisionLabs.Threading")]
16 | [assembly: AssemblyCopyright("Copyright © Sam Harwell 2015")]
17 | [assembly: AssemblyTrademark("")]
18 | [assembly: AssemblyCulture("")]
19 | [assembly: CLSCompliant(true)]
20 |
21 | #if !PORTABLE
22 | // Setting ComVisible to false makes the types in this assembly not visible
23 | // to COM components. If you need to access a type in this assembly from
24 | // COM, set the ComVisible attribute to true on that type.
25 | [assembly: ComVisible(false)]
26 | #endif
27 |
28 | [assembly: AssemblyVersion("2.1.0.0")]
29 | [assembly: AssemblyFileVersion("2.1.0.0")]
30 | [assembly: AssemblyInformationalVersion("2.1.0-dev")]
31 |
--------------------------------------------------------------------------------
/Rackspace.Threading/System/AwaitExtensions.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3 |
4 | #if NET40PLUS && !NET45PLUS
5 |
6 | using System.Runtime.CompilerServices;
7 |
8 | [assembly: TypeForwardedTo(typeof(AwaitExtensions))]
9 |
10 | #else
11 |
12 | using System;
13 | using System.Threading;
14 | using System.Threading.Tasks;
15 | using Microsoft.Runtime.CompilerServices;
16 |
17 | ///
18 | /// Provides extension methods for threading-related types.
19 | ///
20 | ///
21 | public static class AwaitExtensions
22 | {
23 | /// Gets an awaiter used to await this .
24 | /// The task to await.
25 | /// An awaiter instance.
26 | public static TaskAwaiter GetAwaiter(this Task task)
27 | {
28 | if (task == null)
29 | throw new ArgumentNullException("task");
30 |
31 | return new TaskAwaiter(task);
32 | }
33 |
34 | /// Gets an awaiter used to await this .
35 | /// Specifies the type of data returned by the task.
36 | /// The task to await.
37 | /// An awaiter instance.
38 | public static TaskAwaiter GetAwaiter(this Task task)
39 | {
40 | if (task == null)
41 | throw new ArgumentNullException("task");
42 |
43 | return new TaskAwaiter(task);
44 | }
45 |
46 | /// Creates and configures an awaitable object for awaiting the specified task.
47 | /// The task to be awaited.
48 | ///
49 | /// to automatically marshal back to the original call site's current
50 | /// or ; otherwise, .
51 | ///
52 | /// The instance to be awaited.
53 | public static ConfiguredTaskAwaitable ConfigureAwait(this Task task, bool continueOnCapturedContext)
54 | {
55 | if (task == null)
56 | throw new ArgumentNullException("task");
57 |
58 | return new ConfiguredTaskAwaitable(task, continueOnCapturedContext);
59 | }
60 |
61 | /// Creates and configures an awaitable object for awaiting the specified task.
62 | /// The return type of the .
63 | /// The task to be awaited.
64 | ///
65 | /// to automatically marshal back to the original call site's current
66 | /// or ; otherwise, .
67 | ///
68 | /// The instance to be awaited.
69 | public static ConfiguredTaskAwaitable ConfigureAwait(this Task task, bool continueOnCapturedContext)
70 | {
71 | if (task == null)
72 | throw new ArgumentNullException("task");
73 |
74 | return new ConfiguredTaskAwaitable(task, continueOnCapturedContext);
75 | }
76 | }
77 |
78 | #endif
79 |
--------------------------------------------------------------------------------
/Rackspace.Threading/System/ExecutionContextLightup.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3 |
4 | #if !NET40PLUS
5 |
6 | // The reference source is missing documentation
7 | #pragma warning disable SA1600 // Elements must be documented
8 |
9 | namespace System
10 | {
11 | using System;
12 | using System.Reflection;
13 |
14 | internal class ExecutionContextLightup : Lightup
15 | {
16 | public static readonly ExecutionContextLightup Instance = new ExecutionContextLightup(null);
17 | private readonly object _executionContext;
18 | private Delegate _dispose;
19 | private Delegate _capture;
20 | private Delegate _run;
21 | private Delegate _createCopy;
22 |
23 | private ExecutionContextLightup(object executionContext)
24 | : base(LightupType.ExecutionContext)
25 | {
26 | _executionContext = executionContext;
27 | }
28 |
29 | protected override object GetInstance()
30 | {
31 | return _executionContext;
32 | }
33 |
34 | public ExecutionContextLightup Capture()
35 | {
36 | object executionContext;
37 | if (TryCall(ref _capture, "Capture", out executionContext) && executionContext != null)
38 | {
39 | return new ExecutionContextLightup(executionContext);
40 | }
41 |
42 | return null;
43 | }
44 |
45 | public ExecutionContextLightup CreateCopy()
46 | {
47 | object copy = Call