diff options
author | Steve Block <steveblock@google.com> | 2010-08-27 09:31:37 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-08-27 09:31:37 -0700 |
commit | 189b695745c6020d8bfb156a3feed6179a40421a (patch) | |
tree | 1f02fe13154ad48403c4b1770dacf70c048672a1 /ANGLE/src/compiler/osinclude.h | |
parent | 15ab92005269321455230f35e1ea62e57ebce324 (diff) | |
parent | a9bfd6c4a32dfd9cc032cb67c6ccb8d09c16f579 (diff) | |
download | external_webkit-189b695745c6020d8bfb156a3feed6179a40421a.zip external_webkit-189b695745c6020d8bfb156a3feed6179a40421a.tar.gz external_webkit-189b695745c6020d8bfb156a3feed6179a40421a.tar.bz2 |
Merge "Add ANGLE at r65615"
Diffstat (limited to 'ANGLE/src/compiler/osinclude.h')
-rw-r--r-- | ANGLE/src/compiler/osinclude.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/ANGLE/src/compiler/osinclude.h b/ANGLE/src/compiler/osinclude.h new file mode 100644 index 0000000..d887914 --- /dev/null +++ b/ANGLE/src/compiler/osinclude.h @@ -0,0 +1,62 @@ +// +// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +#ifndef __OSINCLUDE_H +#define __OSINCLUDE_H + +// +// This file contains contains the window's specific datatypes and +// declares any windows specific functions. +// + +#if defined(_WIN32) || defined(_WIN64) +#define ANGLE_OS_WIN +#elif defined(__APPLE__) || defined(__linux__) || \ + defined(__FreeBSD__) || defined(__OpenBSD__) || \ + defined(__sun) +#define ANGLE_OS_POSIX +#else +#error Unsupported platform. +#endif + +#if defined(ANGLE_OS_WIN) +#define STRICT +#define VC_EXTRALEAN 1 +#include <windows.h> +#elif defined(ANGLE_OS_POSIX) +#include <pthread.h> +#include <semaphore.h> +#include <errno.h> +#endif // ANGLE_OS_WIN + +#include "compiler/debug.h" + +// +// Thread Local Storage Operations +// +#if defined(ANGLE_OS_WIN) +typedef DWORD OS_TLSIndex; +#define OS_INVALID_TLS_INDEX (TLS_OUT_OF_INDEXES) +#elif defined(ANGLE_OS_POSIX) +typedef unsigned int OS_TLSIndex; +#define OS_INVALID_TLS_INDEX 0xFFFFFFFF +#endif // ANGLE_OS_WIN + +OS_TLSIndex OS_AllocTLSIndex(); +bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue); +bool OS_FreeTLSIndex(OS_TLSIndex nIndex); + +inline void* OS_GetTLSValue(OS_TLSIndex nIndex) +{ + assert(nIndex != OS_INVALID_TLS_INDEX); +#if defined(ANGLE_OS_WIN) + return TlsGetValue(nIndex); +#elif defined(ANGLE_OS_POSIX) + return pthread_getspecific(nIndex); +#endif // ANGLE_OS_WIN +} + +#endif // __OSINCLUDE_H |