InitializeSynchronizationBarrier function (synchapi.h)

Initializes a new synchronization barrier.

Syntax

BOOL InitializeSynchronizationBarrier(
  [out] LPSYNCHRONIZATION_BARRIER lpBarrier,
  [in]  LONG                      lTotalThreads,
  [in]  LONG                      lSpinCount
);

Parameters

[out] lpBarrier

A pointer to the SYNCHRONIZATION_BARRIER structure to initialize. This is an opaque structure that should not be modified by applications.

[in] lTotalThreads

The maximum number of threads that can enter this barrier. After the maximum number of threads have entered the barrier, all threads continue.

[in] lSpinCount

The number of times an individual thread should spin while waiting for other threads to arrive at the barrier. If this parameter is -1, the thread spins 2000 times. If the thread exceeds lSpinCount, the thread blocks unless it called EnterSynchronizationBarrier with SYNCHRONIZATION_BARRIER_FLAGS_SPIN_ONLY.

Return value

TRUE if the barrier was successfully initialized. If the barrier was not successfully initialized, this function returns FALSE. Use GetLastError to get extended error information.

Requirements

Requirement Value
Minimum supported client Windows 8 [desktop apps only]
Minimum supported server Windows Server 2012 [desktop apps only]
Target Platform Windows
Header synchapi.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See also

DeleteSynchronizationBarrier

EnterSynchronizationBarrier

Synchronization Barriers

Vertdll APIs available in VBS enclaves