michael@0: // michael@0: // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: // michael@0: michael@0: #include "compiler/osinclude.h" michael@0: // michael@0: // This file contains contains the window's specific functions michael@0: // michael@0: michael@0: #if !defined(ANGLE_OS_WIN) michael@0: #error Trying to build a windows specific file in a non windows build. michael@0: #endif michael@0: michael@0: michael@0: // michael@0: // Thread Local Storage Operations michael@0: // michael@0: OS_TLSIndex OS_AllocTLSIndex() michael@0: { michael@0: DWORD dwIndex = TlsAlloc(); michael@0: if (dwIndex == TLS_OUT_OF_INDEXES) { michael@0: assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage"); michael@0: return OS_INVALID_TLS_INDEX; michael@0: } michael@0: michael@0: return dwIndex; michael@0: } michael@0: michael@0: michael@0: bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue) michael@0: { michael@0: if (nIndex == OS_INVALID_TLS_INDEX) { michael@0: assert(0 && "OS_SetTLSValue(): Invalid TLS Index"); michael@0: return false; michael@0: } michael@0: michael@0: if (TlsSetValue(nIndex, lpvValue)) michael@0: return true; michael@0: else michael@0: return false; michael@0: } michael@0: michael@0: michael@0: bool OS_FreeTLSIndex(OS_TLSIndex nIndex) michael@0: { michael@0: if (nIndex == OS_INVALID_TLS_INDEX) { michael@0: assert(0 && "OS_SetTLSValue(): Invalid TLS Index"); michael@0: return false; michael@0: } michael@0: michael@0: if (TlsFree(nIndex)) michael@0: return true; michael@0: else michael@0: return false; michael@0: }