InitializeSynchronizationBarrier function

Initializes a new synchronization barrier.

Syntax

BOOL InitializeSynchronizationBarrier(
  LPSYNCHRONIZATION_BARRIER lpBarrier,
  LONG                      lTotalThreads,
  LONG                      lSpinCount
);

Parameters

lpBarrier

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

lTotalThreads

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

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

   
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