Click here to Skip to main content
15,914,225 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalhtml generation Pin
vishalkohli7-Mar-04 19:11
vishalkohli7-Mar-04 19:11 
GeneralRe: html generation Pin
Prakash Nadar7-Mar-04 19:19
Prakash Nadar7-Mar-04 19:19 
GeneralRe: html generation Pin
George L. Jackson8-Mar-04 8:01
George L. Jackson8-Mar-04 8:01 
GeneralRe: html generation Pin
basementman8-Mar-04 13:13
basementman8-Mar-04 13:13 
GeneralGetFocus() returns NULL Pin
Swinefeaster7-Mar-04 18:58
Swinefeaster7-Mar-04 18:58 
GeneralRe: GetFocus() returns NULL Pin
Prakash Nadar7-Mar-04 19:07
Prakash Nadar7-Mar-04 19:07 
Generaldirectx 8 / 9 issues Pin
siniani7-Mar-04 16:24
siniani7-Mar-04 16:24 
GeneralThread programming question Pin
Madmaximus7-Mar-04 15:41
Madmaximus7-Mar-04 15:41 
I have a question about the proper way of closing a thread with Windows APIs.
This is pseudo code. I left out details for clarity.


HANDLE m_hConEvent};
class ThreadA;
void main(void)
{
ThreadA *pthreadA = new ThreadA(); //Do I need to remove pointer from the heap.

do some stuff...
Wait();

}

class ThreadA
{
public
ThreadA()
{
CreateThread(FuncPtr);
SetEvent(m_hConEvent);

}
~ThreadA() {};

static int FuncPtr()
{
bool bExit;
HANDLE arHandles[] = {m_hTerminatorX, m_hConEvent};

while(bExit)
{
dwWait = WaitForMultipleObjects(2, arHandles, FALSE, INFINITE);

switch(dwWait)
{
case WAIT_OBJECT_0 + 1 :
{
//Do some stuff. Now done with thread or errored out.
SetEvent(m_hTerminatorX);
}
break;
case WAIT_OBJECT_0 :
{
bExit = false;
}
break;
}
}
//Now I'm done with thread do I need to remove *pthreadA pointer?
// Like use "delete this" command to remove the pointer from the heap?
delete this;
}
};

Thanks in advance. Wink | ;)


GeneralRe: Thread programming question Pin
Prakash Nadar7-Mar-04 15:48
Prakash Nadar7-Mar-04 15:48 
GeneralRe: Thread programming question Pin
Madmaximus7-Mar-04 16:19
Madmaximus7-Mar-04 16:19 
GeneralRe: Thread programming question Pin
Prakash Nadar7-Mar-04 16:38
Prakash Nadar7-Mar-04 16:38 
GeneralRe: Thread programming question Pin
Curi0us_George7-Mar-04 16:43
Curi0us_George7-Mar-04 16:43 
Generalhot to set the step value in spin Pin
Mughi7-Mar-04 15:26
Mughi7-Mar-04 15:26 
GeneralRe: hot to set the step value in spin Pin
Prakash Nadar8-Mar-04 1:10
Prakash Nadar8-Mar-04 1:10 
GeneralRe: hot to set the step value in spin Pin
David Crow8-Mar-04 4:47
David Crow8-Mar-04 4:47 
GeneralRe: hot to set the step value in spin Pin
Roger Wright8-Mar-04 9:21
professionalRoger Wright8-Mar-04 9:21 
GeneralRe: hot to set the step value in spin Pin
David Crow8-Mar-04 9:28
David Crow8-Mar-04 9:28 
GeneralRe: hot to set the step value in spin Pin
Roger Wright8-Mar-04 10:09
professionalRoger Wright8-Mar-04 10:09 
GeneralNeed opinions on proposed Plugin framework Pin
Anonymous7-Mar-04 15:13
Anonymous7-Mar-04 15:13 
GeneralRe: Need opinions on proposed Plugin framework Pin
Prakash Nadar7-Mar-04 15:43
Prakash Nadar7-Mar-04 15:43 
GeneralI need help understanding this part of DirectShow SDK Pin
Redbehelit7-Mar-04 15:10
Redbehelit7-Mar-04 15:10 
GeneralRe: I need help understanding this part of DirectShow SDK Pin
GDavy7-Mar-04 19:58
GDavy7-Mar-04 19:58 
GeneralC++ Question. Pin
WREY7-Mar-04 14:05
WREY7-Mar-04 14:05 
GeneralRe: C++ Question. Pin
Prakash Nadar7-Mar-04 14:58
Prakash Nadar7-Mar-04 14:58 
GeneralRe: C++ Question. Pin
WREY7-Mar-04 15:58
WREY7-Mar-04 15:58 

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.