Share via


TeamFoundationLockingService.AcquireLock Method (TeamFoundationRequestContext, TeamFoundationLockMode, String, Int32)

Gets a cross-process lock on the given resource.

Namespace:  Microsoft.TeamFoundation.Framework.Server
Assembly:  Microsoft.TeamFoundation.Framework.Server (in Microsoft.TeamFoundation.Framework.Server.dll)

Syntax

'Declaration
Public Function AcquireLock ( _
    requestContext As TeamFoundationRequestContext, _
    lockMode As TeamFoundationLockMode, _
    resource As String, _
    lockTimeout As Integer _
) As TeamFoundationLock
public TeamFoundationLock AcquireLock(
    TeamFoundationRequestContext requestContext,
    TeamFoundationLockMode lockMode,
    string resource,
    int lockTimeout
)
public:
TeamFoundationLock^ AcquireLock(
    TeamFoundationRequestContext^ requestContext, 
    TeamFoundationLockMode lockMode, 
    String^ resource, 
    int lockTimeout
)
member AcquireLock : 
        requestContext:TeamFoundationRequestContext * 
        lockMode:TeamFoundationLockMode * 
        resource:string * 
        lockTimeout:int -> TeamFoundationLock
public function AcquireLock(
    requestContext : TeamFoundationRequestContext, 
    lockMode : TeamFoundationLockMode, 
    resource : String, 
    lockTimeout : int
) : TeamFoundationLock

Parameters

  • lockTimeout
    Type: System.Int32

    The maximum time-out to wait for the lock in milliseconds. To indicate that a lock request should fail instead of wait for the lock when the request cannot be granted immediately, specify 0.

Return Value

Type: Microsoft.TeamFoundation.Framework.Server.TeamFoundationLock
The lock on this resource, if obtained in the time-out. This lock should be disposed when it must be released.

.NET Framework Security

See Also

Reference

TeamFoundationLockingService Class

AcquireLock Overload

Microsoft.TeamFoundation.Framework.Server Namespace