This source file includes following definitions.
- atomic_int_get_win32
- atomic_int_set_win32
- atomic_int_add_and_fetch_win32
- atomic_ptr_cas_win32
#ifndef AVUTIL_ATOMIC_WIN32_H
#define AVUTIL_ATOMIC_WIN32_H
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define avpriv_atomic_int_get atomic_int_get_win32
static inline int atomic_int_get_win32(volatile int *ptr)
{
MemoryBarrier();
return *ptr;
}
#define avpriv_atomic_int_set atomic_int_set_win32
static inline void atomic_int_set_win32(volatile int *ptr, int val)
{
*ptr = val;
MemoryBarrier();
}
#define avpriv_atomic_int_add_and_fetch atomic_int_add_and_fetch_win32
static inline int atomic_int_add_and_fetch_win32(volatile int *ptr, int inc)
{
return inc + InterlockedExchangeAdd(ptr, inc);
}
#define avpriv_atomic_ptr_cas atomic_ptr_cas_win32
static inline void *atomic_ptr_cas_win32(void * volatile *ptr,
void *oldval, void *newval)
{
return InterlockedCompareExchangePointer(ptr, newval, oldval);
}
#endif