共用方式為


AsyncSemaphore.EnterAsync Method (TimeSpan, CancellationToken)

Requests access to the lock.

Namespace:  Microsoft.VisualStudio.Threading
Assembly:  Microsoft.VisualStudio.Threading (in Microsoft.VisualStudio.Threading.dll)

Syntax

'Declaration
Public Function EnterAsync ( _
    timeout As TimeSpan, _
    cancellationToken As CancellationToken _
) As Task(Of AsyncSemaphore.Releaser)
public Task<AsyncSemaphore.Releaser> EnterAsync(
    TimeSpan timeout,
    CancellationToken cancellationToken
)
public:
Task<AsyncSemaphore::Releaser>^ EnterAsync(
    TimeSpan timeout, 
    CancellationToken cancellationToken
)
member EnterAsync : 
        timeout:TimeSpan * 
        cancellationToken:CancellationToken -> Task<AsyncSemaphore.Releaser> 
public function EnterAsync(
    timeout : TimeSpan, 
    cancellationToken : CancellationToken
) : Task<AsyncSemaphore.Releaser>

Parameters

Return Value

Type: System.Threading.Tasks.Task<AsyncSemaphore.Releaser>
A Task<TResult> whose result is a releaser that should be disposed to release the lock.

.NET Framework Security

See Also

Reference

AsyncSemaphore Class

EnterAsync Overload

Microsoft.VisualStudio.Threading Namespace