#include "common/SimpleMutex.h"
#if ANGLE_USE_FUTEX
# include <limits.h>
# include <stdint.h>
# if defined(ANGLE_PLATFORM_LINUX) || defined(ANGLE_PLATFORM_ANDROID)
# include <linux/futex.h>
# include <sys/syscall.h>
# include <unistd.h>
# endif
# if defined(ANGLE_PLATFORM_WINDOWS)
# include <errno.h>
# include <windows.h>
# endif
namespace angle
{
namespace priv
{
# if defined(ANGLE_PLATFORM_LINUX) || defined(ANGLE_PLATFORM_ANDROID)
namespace
{
ANGLE_INLINE void SysFutex(void *addr, int op, int val, int val3)
{ … }
}
void MutexOnFutex::futexWait()
{ … }
void MutexOnFutex::futexWake()
{ … }
# endif
# if defined(ANGLE_PLATFORM_WINDOWS)
void MutexOnFutex::futexWait()
{
int value = kBlocked;
WaitOnAddress(&mState, &value, sizeof(value), INFINITE);
}
void MutexOnFutex::futexWake()
{
WakeByAddressSingle(&mState);
}
# endif
}
}
#endif