gfx/angle/src/compiler/osinclude.h

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

michael@0 1 //
michael@0 2 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
michael@0 3 // Use of this source code is governed by a BSD-style license that can be
michael@0 4 // found in the LICENSE file.
michael@0 5 //
michael@0 6
michael@0 7 #ifndef __OSINCLUDE_H
michael@0 8 #define __OSINCLUDE_H
michael@0 9
michael@0 10 //
michael@0 11 // This file contains contains os-specific datatypes and
michael@0 12 // declares any os-specific functions.
michael@0 13 //
michael@0 14
michael@0 15 #if defined(_WIN32) || defined(_WIN64)
michael@0 16 #define ANGLE_OS_WIN
michael@0 17 #elif defined(__APPLE__) || defined(__linux__) || \
michael@0 18 defined(__FreeBSD__) || defined(__OpenBSD__) || \
michael@0 19 defined(__sun) || defined(ANDROID) || \
michael@0 20 defined(__GLIBC__) || defined(__GNU__) || \
michael@0 21 defined(__QNX__)
michael@0 22 #define ANGLE_OS_POSIX
michael@0 23 #else
michael@0 24 #error Unsupported platform.
michael@0 25 #endif
michael@0 26
michael@0 27 #if defined(ANGLE_OS_WIN)
michael@0 28 #define STRICT
michael@0 29 #define VC_EXTRALEAN 1
michael@0 30 #include <windows.h>
michael@0 31 #elif defined(ANGLE_OS_POSIX)
michael@0 32 #include <pthread.h>
michael@0 33 #include <semaphore.h>
michael@0 34 #include <errno.h>
michael@0 35 #endif // ANGLE_OS_WIN
michael@0 36
michael@0 37
michael@0 38 #include "compiler/compiler_debug.h"
michael@0 39
michael@0 40 //
michael@0 41 // Thread Local Storage Operations
michael@0 42 //
michael@0 43 #if defined(ANGLE_OS_WIN)
michael@0 44 typedef DWORD OS_TLSIndex;
michael@0 45 #define OS_INVALID_TLS_INDEX (TLS_OUT_OF_INDEXES)
michael@0 46 #elif defined(ANGLE_OS_POSIX)
michael@0 47 typedef pthread_key_t OS_TLSIndex;
michael@0 48 #define OS_INVALID_TLS_INDEX (static_cast<OS_TLSIndex>(-1))
michael@0 49 #endif // ANGLE_OS_WIN
michael@0 50
michael@0 51 OS_TLSIndex OS_AllocTLSIndex();
michael@0 52 bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue);
michael@0 53 bool OS_FreeTLSIndex(OS_TLSIndex nIndex);
michael@0 54
michael@0 55 inline void* OS_GetTLSValue(OS_TLSIndex nIndex)
michael@0 56 {
michael@0 57 ASSERT(nIndex != OS_INVALID_TLS_INDEX);
michael@0 58 #if defined(ANGLE_OS_WIN)
michael@0 59 return TlsGetValue(nIndex);
michael@0 60 #elif defined(ANGLE_OS_POSIX)
michael@0 61 return pthread_getspecific(nIndex);
michael@0 62 #endif // ANGLE_OS_WIN
michael@0 63 }
michael@0 64
michael@0 65 #endif // __OSINCLUDE_H

mercurial