#ifndef COMMON_TLS_H_
#define COMMON_TLS_H_
#include "common/angleutils.h"
#include "common/platform.h"
#if defined(ANGLE_PLATFORM_POSIX)
# include <errno.h>
# include <pthread.h>
# include <semaphore.h>
#elif defined(ANGLE_PLATFORM_WINDOWS)
# include <windows.h>
#endif
namespace gl
{
class Context;
}
namespace angle
{
#ifdef ANGLE_PLATFORM_WINDOWS
# ifdef ANGLE_ENABLE_WINDOWS_UWP
# ifndef TLS_OUT_OF_INDEXES
#define TLS_OUT_OF_INDEXES …
# endif
# ifndef CREATE_SUSPENDED
#define CREATE_SUSPENDED …
# endif
# endif
typedef DWORD TLSIndex;
#define TLS_INVALID_INDEX …
#elif defined(ANGLE_PLATFORM_POSIX)
TLSIndex;
#define TLS_INVALID_INDEX …
#else
# error Unsupported platform.
#endif
#if defined(ANGLE_USE_ANDROID_TLS_SLOT)
# if defined(__arm__) || defined(__aarch64__)
constexpr size_t kAndroidOpenGLTlsSlot = 3;
# elif defined(__i386__) || defined(__x86_64__)
constexpr size_t kAndroidOpenGLTlsSlot = 3;
# elif defined(__riscv)
constexpr int kAndroidOpenGLTlsSlot = -5;
# else
# error Unsupported platform.
# endif
# if defined(__aarch64__)
#define ANGLE_ANDROID_GET_GL_TLS …
# elif defined(__arm__)
#define ANGLE_ANDROID_GET_GL_TLS …
# elif defined(__mips__)
#define ANGLE_ANDROID_GET_GL_TLS …
# elif defined(__i386__)
#define ANGLE_ANDROID_GET_GL_TLS …
# elif defined(__x86_64__)
#define ANGLE_ANDROID_GET_GL_TLS …
# elif defined(__riscv)
#define ANGLE_ANDROID_GET_GL_TLS …
# else
# error unsupported architecture
# endif
#endif
PthreadKeyDestructor;
TLSIndex CreateTLSIndex(PthreadKeyDestructor destructor);
bool DestroyTLSIndex(TLSIndex index);
bool SetTLSValue(TLSIndex index, void *value);
void *GetTLSValue(TLSIndex index);
}
#endif