Share via


Semaphore::Lock Method

Waits until the current object, or the Semaphore object associated with the specified handle, is in the signaled state or the specified time-out interval has elapsed.

SyncLock Lock(
   DWORD milliseconds = INFINITE
);

static SyncLock Lock(
   HANDLE h,
   DWORD milliseconds = INFINITE
);

Parameters

  • milliseconds
    The time-out interval, in milliseconds. The default value is INFINITE, which waits indefinitely.

  • h
    A handle to a Semaphore object.

Return Value

A Details::SyncLockWithStatusT<HandleTraits::SemaphoreTraits>

Requirements

Header: corewrappers.h

Namespace: Microsoft::WRL::Wrappers

See Also

Reference

Semaphore Class