mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 17:12:57 +00:00
[MSCTFIME] Add TLS::PeekTLS and use it
Refactoring. CORE-19360
This commit is contained in:
parent
e0eab48aee
commit
dfd6d7f32a
1 changed files with 15 additions and 9 deletions
|
@ -344,8 +344,17 @@ public:
|
||||||
return InternalAllocateTLS();
|
return InternalAllocateTLS();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
static TLS* PeekTLS()
|
||||||
|
{
|
||||||
|
return (TLS*)::TlsGetValue(TLS::s_dwTlsIndex);
|
||||||
|
}
|
||||||
|
|
||||||
static TLS* InternalAllocateTLS();
|
static TLS* InternalAllocateTLS();
|
||||||
static BOOL InternalDestroyTLS();
|
static BOOL InternalDestroyTLS();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
DWORD TLS::s_dwTlsIndex = (DWORD)-1;
|
DWORD TLS::s_dwTlsIndex = (DWORD)-1;
|
||||||
|
@ -355,7 +364,7 @@ DWORD TLS::s_dwTlsIndex = (DWORD)-1;
|
||||||
*/
|
*/
|
||||||
TLS* TLS::InternalAllocateTLS()
|
TLS* TLS::InternalAllocateTLS()
|
||||||
{
|
{
|
||||||
TLS *pTLS = (TLS *)::TlsGetValue(TLS::s_dwTlsIndex);
|
TLS *pTLS = TLS::PeekTLS();
|
||||||
if (pTLS)
|
if (pTLS)
|
||||||
return pTLS;
|
return pTLS;
|
||||||
|
|
||||||
|
@ -382,10 +391,7 @@ TLS* TLS::InternalAllocateTLS()
|
||||||
*/
|
*/
|
||||||
BOOL TLS::InternalDestroyTLS()
|
BOOL TLS::InternalDestroyTLS()
|
||||||
{
|
{
|
||||||
if (s_dwTlsIndex == (DWORD)-1)
|
TLS *pTLS = TLS::PeekTLS();
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
TLS *pTLS = (TLS *)::TlsGetValue(s_dwTlsIndex);
|
|
||||||
if (!pTLS)
|
if (!pTLS)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -460,7 +466,7 @@ STDMETHODIMP_(ULONG) CicBridge::Release()
|
||||||
*/
|
*/
|
||||||
CicBridge::~CicBridge()
|
CicBridge::~CicBridge()
|
||||||
{
|
{
|
||||||
TLS *pTLS = (TLS *)TlsGetValue(TLS::s_dwTlsIndex);
|
TLS *pTLS = TLS::PeekTLS();
|
||||||
if (!pTLS || !pTLS->m_pThreadMgr)
|
if (!pTLS || !pTLS->m_pThreadMgr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -718,7 +724,7 @@ ImeDestroy(
|
||||||
{
|
{
|
||||||
TRACE("(%u)\n", uReserved);
|
TRACE("(%u)\n", uReserved);
|
||||||
|
|
||||||
TLS *pTLS = (TLS *)::TlsGetValue(TLS::s_dwTlsIndex);
|
TLS *pTLS = TLS::PeekTLS();
|
||||||
if (pTLS)
|
if (pTLS)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -1009,7 +1015,7 @@ CtfImeDestroyThreadMgr(VOID)
|
||||||
{
|
{
|
||||||
TRACE("()\n");
|
TRACE("()\n");
|
||||||
|
|
||||||
TLS *pTLS = (TLS *)::TlsGetValue(TLS::s_dwTlsIndex);
|
TLS *pTLS = TLS::PeekTLS();
|
||||||
if (!pTLS)
|
if (!pTLS)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
@ -1051,7 +1057,7 @@ CtfImeDestroyInputContext(
|
||||||
{
|
{
|
||||||
TRACE("(%p)\n", hIMC);
|
TRACE("(%p)\n", hIMC);
|
||||||
|
|
||||||
TLS *pTLS = (TLS*)::TlsGetValue(TLS::s_dwTlsIndex);
|
TLS *pTLS = TLS::PeekTLS();
|
||||||
if (!pTLS || !pTLS->m_pBridge)
|
if (!pTLS || !pTLS->m_pBridge)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue