-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/dotnet/SqlClient into add-c…
…omponentmodel-to-netcoresrc # Conflicts: # src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj
- Loading branch information
Showing
84 changed files
with
2,442 additions
and
1,953 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -242,7 +242,5 @@ public CustomerRecord(int id, string fName, string lName) | |
} | ||
} | ||
} | ||
|
||
//</Snippet1> | ||
|
||
} | ||
//</Snippet1> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
src/Microsoft.Data.SqlClient/netcore/src/Common/perf/PerfRunner/AssemblyAttributes.cs
This file was deleted.
Oops, something went wrong.
46 changes: 0 additions & 46 deletions
46
src/Microsoft.Data.SqlClient/netcore/src/Common/perf/PerfRunner/PerfRunner.cs
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
src/Microsoft.Data.SqlClient/netcore/src/Common/perf/PerfRunner/PerfRunner.csproj
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
...Microsoft.Data.SqlClient/netcore/src/Common/perf/PerfRunner/PerfRunner.runtimeconfig.json
This file was deleted.
Oops, something went wrong.
60 changes: 60 additions & 0 deletions
60
...osoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/ConcurrentQueueSemaphore.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// 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.Collections.Concurrent; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace Microsoft.Data.SqlClient.SNI | ||
{ | ||
/// <summary> | ||
/// This class implements a FIFO Queue with SemaphoreSlim for ordered execution of parallel tasks. | ||
/// Currently used in Managed SNI (SNISslStream) to override SslStream's WriteAsync implementation. | ||
/// </summary> | ||
internal sealed partial class ConcurrentQueueSemaphore | ||
{ | ||
private readonly SemaphoreSlim _semaphore; | ||
private readonly ConcurrentQueue<TaskCompletionSource<bool>> _queue; | ||
|
||
public ConcurrentQueueSemaphore(int initialCount) | ||
{ | ||
_semaphore = new SemaphoreSlim(initialCount); | ||
_queue = new ConcurrentQueue<TaskCompletionSource<bool>>(); | ||
} | ||
|
||
public Task WaitAsync(CancellationToken cancellationToken) | ||
{ | ||
// try sync wait with 0 which will not block to see if we need to do an async wait | ||
if (_semaphore.Wait(0, cancellationToken)) | ||
{ | ||
return Task.CompletedTask; | ||
} | ||
else | ||
{ | ||
var tcs = new TaskCompletionSource<bool>(); | ||
_queue.Enqueue(tcs); | ||
_semaphore.WaitAsync().ContinueWith( | ||
continuationAction: static (Task task, object state) => | ||
{ | ||
ConcurrentQueue<TaskCompletionSource<bool>> queue = (ConcurrentQueue<TaskCompletionSource<bool>>)state; | ||
if (queue.TryDequeue(out TaskCompletionSource<bool> popped)) | ||
{ | ||
popped.SetResult(true); | ||
} | ||
}, | ||
state: _queue, | ||
cancellationToken: cancellationToken | ||
); | ||
return tcs.Task; | ||
} | ||
} | ||
|
||
public void Release() | ||
{ | ||
_semaphore.Release(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.