Export (0) Print
Expand All
Expand Minimize

InitializeSynchronizationBarrier function

Initializes a new synchronization barrier.

Syntax


BOOL WINAPI InitializeSynchronizationBarrier(
  _Out_  LPSYNCHRONIZATION_BARRIER lpBarrier,
  _In_   LONG lTotalThreads,
  _In_   LONG lSpinCount
);

Parameters

lpBarrier [out]

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

lTotalThreads [in]

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

lSpinCount [in]

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]

Header

SynchAPI.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

EnterSynchronizationBarrier
DeleteSynchronizationBarrier
Synchronization Barriers

 

 

Community Additions

ADD
Show:
© 2014 Microsoft