ReactOS 0.4.16-dev-125-g798ea90
tls.c File Reference
#include <precomp.h>
#include <stdlib.h>
#include <internal/tls.h>
#include <internal/rterror.h>
Include dependency graph for tls.c:

Go to the source code of this file.

Functions

BOOL msvcrt_init_tls (void)
 
BOOL msvcrt_free_tls (void)
 
thread_data_tmsvcrt_get_thread_data (void)
 
void msvcrt_free_tls_mem (void)
 

Variables

static DWORD msvcrt_tls_index
 

Function Documentation

◆ msvcrt_free_tls()

BOOL msvcrt_free_tls ( void  )

Definition at line 21 of file tls.c.

22{
24 {
25 ERR("TlsFree() failed!\n");
26 return FALSE;
27 }
28 return TRUE;
29}
#define ERR(fmt,...)
Definition: precomp.h:57
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI TlsFree(IN DWORD Index)
Definition: thread.c:1166
static DWORD msvcrt_tls_index
Definition: tls.c:7

Referenced by DllMain(), and msvcrt_init_exception().

◆ msvcrt_free_tls_mem()

void msvcrt_free_tls_mem ( void  )

Definition at line 51 of file tls.c.

52{
54
55 if (tls)
56 {
57 CloseHandle(tls->handle);
58 HeapFree(GetProcessHeap(),0,tls->efcvt_buffer);
59 HeapFree(GetProcessHeap(),0,tls->asctime_buffer);
60 HeapFree(GetProcessHeap(),0,tls->wasctime_buffer);
61 HeapFree(GetProcessHeap(),0,tls->strerror_buffer);
62 HeapFree(GetProcessHeap(),0,tls->wcserror_buffer);
63 HeapFree(GetProcessHeap(),0,tls->time_buffer);
64 //if(tls->have_locale) {
65 // free_locinfo(tls->locinfo);
66 // free_mbcinfo(tls->mbcinfo);
67 //}
68 }
70}
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1240
static DWORD tls
Definition: sock.c:229

Referenced by DllMain(), and msvcrt_init_exception().

◆ msvcrt_get_thread_data()

thread_data_t * msvcrt_get_thread_data ( void  )

Definition at line 31 of file tls.c.

32{
34 DWORD err = GetLastError(); /* need to preserve last error */
35
37 {
38 if (!(ptr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ptr) )))
41 ptr->tid = GetCurrentThreadId();
42 ptr->handle = INVALID_HANDLE_VALUE;
43 ptr->random_seed = 1;
44 ptr->locinfo = MSVCRT_locale->locinfo;
45 ptr->mbcinfo = MSVCRT_locale->mbcinfo;
46 }
48 return ptr;
49}
#define SetLastError(x)
Definition: compat.h:752
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
BOOL WINAPI TlsSetValue(IN DWORD Index, IN LPVOID Value)
Definition: thread.c:1276
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MSVCRT_locale
Definition: locale.h:78
static PVOID ptr
Definition: dispmode.c:27
#define _RT_THREAD
Definition: msvcrt.h:267
void __cdecl _amsg_exit(int errnum)
Definition: amsg.c:44
#define err(...)
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459

Referenced by __CxxRegisterExceptionObject(), __CxxUnregisterExceptionObject(), __doserrno(), __fpecode(), __pxcptinfoptrs(), __wcserror(), _beginthread_trampoline(), _configthreadlocale(), _CreateFrameInfo(), _errno(), _FindAndUnlinkFrame(), _gmtime64(), _IsExceptionObjectToBeDestroyed(), _strerror(), _tasctime(), _wcserror(), _wtmpnam(), get_locinfo(), get_mbcinfo(), MSVCRT___pxcptinfoptrs(), MSVCRT___uncaught_exception(), MSVCRT__get_terminate(), MSVCRT__get_unexpected(), MSVCRT__set_se_translator(), MSVCRT_set_unexpected(), MSVCRT_terminate(), MSVCRT_unexpected(), rand(), srand(), strerror(), strtok(), tmpnam(), and wcstok().

◆ msvcrt_init_tls()

BOOL msvcrt_init_tls ( void  )

Definition at line 9 of file tls.c.

10{
12
14 {
15 ERR("TlsAlloc() failed!\n");
16 return FALSE;
17 }
18 return TRUE;
19}
DWORD WINAPI TlsAlloc(VOID)
Definition: thread.c:1100
#define TLS_OUT_OF_INDEXES
Definition: winbase.h:549

Referenced by crt_process_init(), and DllMain().

Variable Documentation

◆ msvcrt_tls_index

DWORD msvcrt_tls_index
static

Definition at line 7 of file tls.c.

Referenced by msvcrt_free_tls(), msvcrt_free_tls_mem(), msvcrt_get_thread_data(), and msvcrt_init_tls().