Click here to Skip to main content
16,006,535 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: HtmlView event Pin
jeremysay28-Jan-03 2:04
jeremysay28-Jan-03 2:04 
GeneralRe: HtmlView event Pin
KaЯl28-Jan-03 2:28
KaЯl28-Jan-03 2:28 
GeneralRe: HtmlView event Pin
HENDRIK R28-Jan-03 2:20
HENDRIK R28-Jan-03 2:20 
GeneralRe: HtmlView event Pin
jeremysay28-Jan-03 4:17
jeremysay28-Jan-03 4:17 
GeneralRe: HtmlView event Pin
jeremysay29-Jan-03 4:58
jeremysay29-Jan-03 4:58 
GeneralHelp on SQL APIs Pin
bachan27-Jan-03 21:38
bachan27-Jan-03 21:38 
GeneralRe: Help on SQL APIs Pin
karl_w28-Jan-03 3:51
karl_w28-Jan-03 3:51 
GeneralQuestion about Tls in child thread. Pin
George227-Jan-03 19:37
George227-Jan-03 19:37 
Hi, everyone!

In my main function, I allocate a Tls index and creates
a father thread, and the father thread creates a child
thread. I want to know whether I can safely use the Tls index
in the child thread?

The following are the sample codes.

Thanks in advance,
George



DWORD dwTlsIndex;

DWORD WINAPI ChildFunction(VOID)
{
//can we use Tls by dwTlsIndex here?

return 0;
}

DWORD WINAPI ThreadFunc(VOID)
{
//use Tls by dwTlsIndex;

//create another child thread from this thread
//suppose the thread function of the child thread is
//ChildFunction
return 0;
}

DWORD main(VOID)
{
DWORD IDThread;
HANDLE hThread;
int i;

dwTlsIndex = TlsAlloc();
hThread = CreateThread(NULL, // no security attributes
0, // use default stack size
(LPTHREAD_START_ROUTINE) ThreadFunc, // thread function
NULL, // no thread function argument
0, // use default creation flags
&IDThread); // returns thread identifier

WaitForSingleObject(hThread, INFINITE);

TlsFree(dwTlsIndex);

return 0;
}
GeneralRe: Question about Tls in child thread. Pin
Mike Nordell28-Jan-03 1:53
Mike Nordell28-Jan-03 1:53 
GeneralClick Check box to change 'read only' attribute of edit box to 'write' attribute Pin
rohit.dhamija27-Jan-03 19:24
rohit.dhamija27-Jan-03 19:24 
GeneralRe: Click Check box to change 'read only' attribute of edit box to 'write' attribute Pin
Rage27-Jan-03 21:05
professionalRage27-Jan-03 21:05 
Questionselected text from IE instance?? Pin
xxhimanshu27-Jan-03 18:31
xxhimanshu27-Jan-03 18:31 
AnswerRe: selected text from IE instance?? Pin
Michael Dunn27-Jan-03 19:16
sitebuilderMichael Dunn27-Jan-03 19:16 
GeneralRe: selected text from IE instance?? Pin
xxhimanshu27-Jan-03 19:39
xxhimanshu27-Jan-03 19:39 
GeneralRe: selected text from IE instance?? Pin
Neville Franks27-Jan-03 23:44
Neville Franks27-Jan-03 23:44 
GeneralRe: selected text from IE instance?? Pin
xxhimanshu28-Jan-03 0:05
xxhimanshu28-Jan-03 0:05 
GeneralProgram crash Pin
Shah Shehpori27-Jan-03 18:15
sussShah Shehpori27-Jan-03 18:15 
GeneralRe: Program crash Pin
Chris Losinger27-Jan-03 19:21
professionalChris Losinger27-Jan-03 19:21 
GeneralRe: Program crash Pin
Mike Nordell27-Jan-03 21:17
Mike Nordell27-Jan-03 21:17 
GeneralRe: Program crash Pin
Neville Franks28-Jan-03 0:17
Neville Franks28-Jan-03 0:17 
QuestionInverse Hyperbolic Sine? Pin
kbmuri27-Jan-03 18:05
kbmuri27-Jan-03 18:05 
AnswerRe: Inverse Hyperbolic Sine? Pin
Chris Losinger27-Jan-03 19:20
professionalChris Losinger27-Jan-03 19:20 
GeneralRe: Inverse Hyperbolic Sine? Pin
kbmuri27-Jan-03 19:51
kbmuri27-Jan-03 19:51 
GeneralSetting Mouse cursor Pin
Mahesh Varma27-Jan-03 17:47
Mahesh Varma27-Jan-03 17:47 
GeneralRe: Setting Mouse cursor Pin
Rage27-Jan-03 20:52
professionalRage27-Jan-03 20:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.