SQL Tools Service
Show / Hide Table of Contents
Improve this Doc View Source

Class AsyncLock

Provides a simple wrapper over a SemaphoreSlim to allow synchronization locking inside of async calls. Cannot be used recursively.

Inheritance
System.Object
AsyncLock
Namespace:Microsoft.SqlTools.ServiceLayer.Utility
Assembly:Microsoft.SqlTools.ServiceLayer.dll
Syntax
public class AsyncLock

Constructors

| Improve this Doc View Source

AsyncLock()

Initializes a new instance of the AsyncLock class.

Declaration
public AsyncLock()

Methods

| Improve this Doc View Source

LockAsync()

Locks

Declaration
public Task<IDisposable> LockAsync()
Returns
Type Description
System.Threading.Tasks.Task<System.IDisposable>

A task which has an IDisposable

| Improve this Doc View Source

LockAsync(CancellationToken)

Obtains or waits for a lock which can be used to synchronize access to a resource. The wait may be cancelled with the given CancellationToken.

Declaration
public Task<IDisposable> LockAsync(CancellationToken cancellationToken)
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken

A CancellationToken which can be used to cancel the lock.

Returns
Type Description
System.Threading.Tasks.Task<System.IDisposable>
  • Improve this Doc
  • View Source
In This Article
  • Constructors
    • AsyncLock()
  • Methods
    • LockAsync()
    • LockAsync(CancellationToken)

© Microsoft  //  Generated with DocFX