What's New in Synchronization

Windows includes the following new programming elements for synchronization.

Windows 8

New Functions

DeleteSynchronizationBarrier

Deletes a synchronization barrier.

EnterSynchronizationBarrier

Causes the calling thread to wait at a synchronization barrier until the maximum number of threads have entered the barrier.

GetOverlappedResultEx

Retrieves the results of an overlapped operation on the specified file, named pipe, or communications device within the specified time-out interval. The calling thread can perform an alertable wait.

InitializeSynchronizationBarrier

Specifies the maximum number of threads and spin count for a new synchronization barrier.

WaitOnAddress

Waits for the value at the specified address to change.

WakeByAddressAll

Wakes all threads that are waiting for the value of an address to change.

WakeByAddressSingle

Wakes one thread that is waiting for the value of an address to change.

New Interlocked Functions

InterlockedAddNoFence

Performs an atomic addition operation on the specified LONG values. The operation is performed atomically, but without using memory barriers.

InterlockedAddNoFence64

Performs an atomic addition operation on the specified LONGLONG values. The operation is performed atomically, but without using memory barriers.

InterlockedAndNoFence

Performs an atomic AND operation on the specified LONG values. The operation is performed atomically, but without using memory barriers.

InterlockedAnd8NoFence

Performs an atomic AND operation on the specified char values. The operation is performed atomically, but without using memory barriers.

InterlockedAnd16NoFence

Performs an atomic AND operation on the specified SHORT values. The operation is performed atomically, but without using memory barriers.

InterlockedAnd64NoFence

Performs an atomic AND operation on the specified LONGLONG values. The operation is performed atomically, but without using memory barriers.

InterlockedBitTestAndComplement64

Tests the specified bit of the specified LONG64 value and complements it. The operation is atomic.

InterlockedBitTestAndResetAcquire

Tests the specified bit of the specified LONG value and sets it to 0. The operation is atomic, and it is performed with acquire memory ordering semantics.

InterlockedBitTestAndResetRelease

Tests the specified bit of the specified LONG value and sets it to 0. The operation is atomic, and it is performed using memory release semantics.

InterlockedBitTestAndSetAcquire

Tests the specified bit of the specified LONG value and sets it to 1. The operation is atomic, and it is performed with acquire memory ordering semantics.

InterlockedBitTestAndSetRelease

Tests the specified bit of the specified LONG value and sets it to 1. The operation is atomic, and it is performed with release memory ordering semantics.

InterlockedCompareExchangeNoFence

Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 32-bit values and exchanges with another 32-bit value based on the outcome of the comparison. The operation is performed atomically, but without using memory barriers.

InterlockedCompareExchange16

Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 16-bit values and exchanges with another 16-bit value based on the outcome of the comparison.

InterlockedCompareExchange16Acquire

Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 16-bit values and exchanges with another 16-bit value based on the outcome of the comparison. The operation is performed with acquire memory ordering semantics.

InterlockedCompareExchange16Release

Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 16-bit values and exchanges with another 16-bit value based on the outcome of the comparison. The exchange is performed with release memory ordering semantics.

InterlockedCompareExchange16NoFence

Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 16-bit values and exchanges with another 16-bit value based on the outcome of the comparison. The operation is performed atomically, but without using memory barriers.

InterlockedCompareExchangeNoFence64

Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 64-bit values and exchanges with another 64-bit value based on the outcome of the comparison. The operation is performed atomically, but without using memory barriers.

InterlockedCompareExchange128

Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 128-bit values and exchanges with another 128-bit value based on the outcome of the comparison.

InterlockedCompareExchangePointerNoFence

Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified pointer values and exchanges with another pointer value based on the outcome of the comparison. The operation is performed atomically, but without using memory barriers.

InterlockedDecrementNoFence

Decrements (decreases by one) the value of the specified 32-bit variable as an atomic operation. The operation is performed atomically, but without using memory barriers.

InterlockedDecrement16

Decrements (decreases by one) the value of the specified 16-bit variable as an atomic operation.

InterlockedDecrement16Acquire

Decrements (decreases by one) the value of the specified 16-bit variable as an atomic operation. The operation is performed with acquire memory ordering semantics.

InterlockedDecrement16Release

Decrements (decreases by one) the value of the specified 16-bit variable as an atomic operation. The operation is performed with release memory ordering semantics.

InterlockedDecrement16NoFence

Decrements (decreases by one) the value of the specified 16-bit variable as an atomic operation. The operation is performed atomically, but without using memory barriers.

InterlockedDecrementNoFence64

Decrements (decreases by one) the value of the specified 64-bit variable as an atomic operation. The operation is performed atomically, but without using memory barriers.

InterlockedExchangeNoFence

Sets a 64-bit variable to the specified value as an atomic operation. The operation is performed atomically, but without using memory barriers.

InterlockedExchange8

Sets an 8-bit variable to the specified value as an atomic operation.

InterlockedExchange16Acquire

Sets a 16-bit variable to the specified value as an atomic operation. The operation is performed using acquire memory ordering semantics.

InterlockedExchange16NoFence

Sets a 16-bit variable to the specified value as an atomic operation. The operation is performed atomically, but without using memory barriers.

InterlockedExchangeNoFence64

Sets a 64-bit variable to the specified value as an atomic operation. The operation is performed atomically, but without using memory barriers.

InterlockedExchangePointerNoFence

Atomically exchanges a pair of addresses. The operation is performed atomically, but without using memory barriers.

InterlockedExchangeAddNoFence

Performs an atomic addition of two 32-bit values. The operation is performed atomically, but without using memory barriers.

InterlockedExchangeAddNoFence64

Performs an atomic addition of two 64-bit values. The operation is performed atomically, but without using memory barriers.

InterlockedIncrementNoFence

Increments (increases by one) the value of the specified 32-bit variable as an atomic operation. The operation is performed atomically, but without using memory barriers.

InterlockedIncrement16

Increments (increases by one) the value of the specified 16-bit variable as an atomic operation.

InterlockedIncrement16Acquire

Increments (increases by one) the value of the specified 16-bit variable as an atomic operation. The operation is performed using acquire memory ordering semantics.

InterlockedIncrement16Release

Increments (increases by one) the value of the specified 16-bit variable as an atomic operation. The operation is performed using release memory ordering semantics.

InterlockedIncrement16NoFence

Increments (increases by one) the value of the specified 16-bit variable as an atomic operation. The operation is performed atomically, but without using memory barriers.

InterlockedIncrementNoFence64

Increments (increases by one) the value of the specified 64-bit variable as an atomic operation. The operation is performed atomically, but without using memory barriers.

InterlockedOrNoFence

Performs an atomic OR operation on the specified LONG values. The operation is performed atomically, but without using memory barriers.

InterlockedOr8NoFence

Performs an atomic OR operation on the specified char values. The operation is performed atomically, but without using memory barriers.

InterlockedOr16NoFence

Performs an atomic OR operation on the specified SHORT values. The operation is performed atomically, but without using memory barriers.

InterlockedOr64NoFence

Performs an atomic OR operation on the specified LONGLONG values. The operation is performed atomically, but without using memory barriers.

InterlockedPushListSListEx

Inserts a singly-linked list at the front of another singly linked list. Access to the lists is synchronized on a multiprocessor system. This version of the method does not use the __fastcall calling convention.

InterlockedXorNoFence

Performs an atomic XOR operation on the specified LONG values. The operation is performed atomically, but without using memory barriers.

InterlockedXor8NoFence

Performs an atomic XOR operation on the specified char values. The operation is performed atomically, but without using memory barriers.

InterlockedXor16NoFence

Performs an atomic XOR operation on the specified SHORT values. The operation is performed atomically, but without using memory barriers.

InterlockedXor64NoFence

Performs an atomic XOR operation on the specified LONGLONG values. The operation is performed atomically, but without using memory barriers.

Windows 7

New Functions

SetWaitableTimerEx

Activates the specified waitable timer and provides context information for the timer.

TryAcquireSRWLockExclusive

Attempts to acquire a slim reader/writer (SRW) lock in exclusive mode. If the call is successful, the calling thread takes ownership of the lock.

TryAcquireSRWLockShared

Attempts to acquire a slim reader/writer (SRW) lock in shared mode. If the call is successful, the calling thread takes ownership of the lock.

New Structures

REASON_CONTEXT

Contains context information for a timer activated with SetWaitableTimerEx.