TeamFoundationLockingService.AcquireLocks Method (TeamFoundationRequestContext, TeamFoundationLockMode, Int32, array<String )

Gets cross-process locks on one or more resources.

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

Syntax

'Declaration
Public Function AcquireLocks ( _
    requestContext As TeamFoundationRequestContext, _
    lockMode As TeamFoundationLockMode, _
    lockTimeout As Integer, _
    ParamArray resources As String() _
) As TeamFoundationLock
public TeamFoundationLock AcquireLocks(
    TeamFoundationRequestContext requestContext,
    TeamFoundationLockMode lockMode,
    int lockTimeout,
    params string[] resources
)
public:
TeamFoundationLock^ AcquireLocks(
    TeamFoundationRequestContext^ requestContext, 
    TeamFoundationLockMode lockMode, 
    int lockTimeout, 
    ... array<String^>^ resources
)
member AcquireLocks : 
        requestContext:TeamFoundationRequestContext * 
        lockMode:TeamFoundationLockMode * 
        lockTimeout:int * 
        resources:string[] -> TeamFoundationLock
public function AcquireLocks(
    requestContext : TeamFoundationRequestContext, 
    lockMode : TeamFoundationLockMode, 
    lockTimeout : int, 
    ... resources : String[]
) : TeamFoundationLock

Parameters

  • lockTimeout
    Type: System.Int32

    The maximum timeout 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.

  • resources
    Type: array<System.String[]

    The resources to lock on.

Return Value

Type: Microsoft.TeamFoundation.Framework.Server.TeamFoundationLock
The lock on this resource if obtained within the timeout. This lock should be disposed when it needs to be released.

Exceptions

Exception Condition
LockTimeoutException

Thrown if a resource wasn't locked within the timeout supplied.

Remarks

The resources are locked in the order supplied. Order your resources in a consistent manner to avoid deadlocks.

.NET Framework Security

See Also

Reference

TeamFoundationLockingService Class

AcquireLocks Overload

Microsoft.TeamFoundation.Framework.Server Namespace