Home > Archive > VC Language > November 2005 > function to terminate worker thread in VC++
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
function to terminate worker thread in VC++
|
|
| raghunandan_1081@yahoo.com 2005-11-25, 7:02 pm |
| hi Everybody, I am using postquitmessage(GetIndexThread(<thraedname>,
NULL)) function to terminate the thread just below the calling
function.
UINT CHRS_MoleDlg::Thread_Camera(LPVOID param)
{
CHRS_MoleDlg *self=(CHRS_MoleDlg *)param;
for(;;)
self->OnCameraThread();
PostQuitMessage(GetExitCodeThread(Thread
_Camera , NULL));
return 0;
}
but still i am facing problem , actually i dont know exactly where i
should write postquitmessage() what function i should used to terminate
thraed.
please tell me.
| |
| Alexander Grigoriev 2005-11-27, 3:58 am |
| PostQiotMessage allows a message loop to break.
You have an infinite loop in your thread, which will never end.
To end a thread, simply return from it.
To let the thread know it whould end, use an event (unnamed, of course).
<raghunandan_1081@yahoo.com> wrote in message
news:1132927499.479143.72560@f14g2000cwb.googlegroups.com...
> hi Everybody, I am using postquitmessage(GetIndexThread(<thraedname>,
> NULL)) function to terminate the thread just below the calling
> function.
>
> UINT CHRS_MoleDlg::Thread_Camera(LPVOID param)
> {
> CHRS_MoleDlg *self=(CHRS_MoleDlg *)param;
> for(;;)
> self->OnCameraThread();
> PostQuitMessage(GetExitCodeThread(Thread
_Camera , NULL));
> return 0;
> }
>
> but still i am facing problem , actually i dont know exactly where i
> should write postquitmessage() what function i should used to terminate
> thraed.
> please tell me.
>
|
|
|
|
|