1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/angle/src/compiler/ossource_win.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,57 @@ 1.4 +// 1.5 +// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. 1.6 +// Use of this source code is governed by a BSD-style license that can be 1.7 +// found in the LICENSE file. 1.8 +// 1.9 + 1.10 +#include "compiler/osinclude.h" 1.11 +// 1.12 +// This file contains contains the window's specific functions 1.13 +// 1.14 + 1.15 +#if !defined(ANGLE_OS_WIN) 1.16 +#error Trying to build a windows specific file in a non windows build. 1.17 +#endif 1.18 + 1.19 + 1.20 +// 1.21 +// Thread Local Storage Operations 1.22 +// 1.23 +OS_TLSIndex OS_AllocTLSIndex() 1.24 +{ 1.25 + DWORD dwIndex = TlsAlloc(); 1.26 + if (dwIndex == TLS_OUT_OF_INDEXES) { 1.27 + assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage"); 1.28 + return OS_INVALID_TLS_INDEX; 1.29 + } 1.30 + 1.31 + return dwIndex; 1.32 +} 1.33 + 1.34 + 1.35 +bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue) 1.36 +{ 1.37 + if (nIndex == OS_INVALID_TLS_INDEX) { 1.38 + assert(0 && "OS_SetTLSValue(): Invalid TLS Index"); 1.39 + return false; 1.40 + } 1.41 + 1.42 + if (TlsSetValue(nIndex, lpvValue)) 1.43 + return true; 1.44 + else 1.45 + return false; 1.46 +} 1.47 + 1.48 + 1.49 +bool OS_FreeTLSIndex(OS_TLSIndex nIndex) 1.50 +{ 1.51 + if (nIndex == OS_INVALID_TLS_INDEX) { 1.52 + assert(0 && "OS_SetTLSValue(): Invalid TLS Index"); 1.53 + return false; 1.54 + } 1.55 + 1.56 + if (TlsFree(nIndex)) 1.57 + return true; 1.58 + else 1.59 + return false; 1.60 +}