Click here to Skip to main content
15,868,016 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionsearch vectors Pin
kaminem13-Apr-09 23:20
kaminem13-Apr-09 23:20 
QuestionRe: search vectors Pin
David Crow14-Apr-09 2:47
David Crow14-Apr-09 2:47 
AnswerRe: search vectors Pin
kaminem14-Apr-09 3:41
kaminem14-Apr-09 3:41 
QuestionRe: search vectors Pin
David Crow14-Apr-09 3:43
David Crow14-Apr-09 3:43 
AnswerRe: search vectors Pin
kaminem14-Apr-09 3:53
kaminem14-Apr-09 3:53 
AnswerRe: search vectors Pin
kaminem16-Apr-09 5:41
kaminem16-Apr-09 5:41 
QuestionHow to Kill the Worker Thread ? Pin
Suresh H13-Apr-09 23:06
Suresh H13-Apr-09 23:06 
AnswerRe: How to Kill the Worker Thread ? Pin
Rajesh R Subramanian13-Apr-09 23:14
professionalRajesh R Subramanian13-Apr-09 23:14 
First of all, you must use AfxBeginThread, if you're using MFC[^].

void CThreadDemoDlg::OnEnd(){
  SetEvent(hEndAllEvent);
}

UINT WorkerThreadXYZ(LPVOID pParams){

  fstream OutFile;
  OutFile.open("FileOne.txt",ios::out);

  for(int i=0;i<10000;i++)
  {
     if(WaitForSingleObject(hEndAllEvent, 0) == WAIT_OBJECT_0) break;
     OutFile  << i << " ";
  }

  OutFile.close();
  return FALSE; //Return false while using CWinThread, unless you know what you're doing, or unless you like memory leaks.
}

Have a look at WaitForSingleObject[^]


It is a crappy thing, but it's life -^ Carlo Pallini

GeneralRe: How to Kill the Worker Thread ? Pin
Suresh H14-Apr-09 0:26
Suresh H14-Apr-09 0:26 
GeneralRe: How to Kill the Worker Thread ? Pin
Rajesh R Subramanian14-Apr-09 0:48
professionalRajesh R Subramanian14-Apr-09 0:48 
AnswerMessage Closed Pin
13-Apr-09 23:26
ParagPatel13-Apr-09 23:26 
GeneralRe: How to Kill the Worker Thread ? [modified] Pin
Hamid_RT13-Apr-09 23:39
Hamid_RT13-Apr-09 23:39 
GeneralRe: How to Kill the Worker Thread ? Pin
Cedric Moonen13-Apr-09 23:41
Cedric Moonen13-Apr-09 23:41 
GeneralRe: How to Kill the Worker Thread ? Pin
Suresh H14-Apr-09 0:00
Suresh H14-Apr-09 0:00 
GeneralRe: How to Kill the Worker Thread ? Pin
Rajesh R Subramanian14-Apr-09 0:04
professionalRajesh R Subramanian14-Apr-09 0:04 
GeneralRe: How to Kill the Worker Thread ? Pin
Cedric Moonen14-Apr-09 0:06
Cedric Moonen14-Apr-09 0:06 
GeneralRe: How to Kill the Worker Thread ? Pin
Cedric Moonen14-Apr-09 0:05
Cedric Moonen14-Apr-09 0:05 
GeneralRe: How to Kill the Worker Thread ? Pin
Suresh H14-Apr-09 0:37
Suresh H14-Apr-09 0:37 
GeneralRe: How to Kill the Worker Thread ? Pin
Cedric Moonen14-Apr-09 0:48
Cedric Moonen14-Apr-09 0:48 
GeneralRe: How to Kill the Worker Thread ? Pin
Rajesh R Subramanian14-Apr-09 1:11
professionalRajesh R Subramanian14-Apr-09 1:11 
GeneralRe: How to Kill the Worker Thread ? Pin
Cedric Moonen14-Apr-09 1:32
Cedric Moonen14-Apr-09 1:32 
GeneralRe: How to Kill the Worker Thread ? Pin
Rajesh R Subramanian14-Apr-09 1:43
professionalRajesh R Subramanian14-Apr-09 1:43 
GeneralRe: How to Kill the Worker Thread ? [modified] Pin
ParagPatel14-Apr-09 0:27
ParagPatel14-Apr-09 0:27 
GeneralRe: How to Kill the Worker Thread ? Pin
David Crow14-Apr-09 3:02
David Crow14-Apr-09 3:02 
GeneralRe: How to Kill the Worker Thread ? Pin
ParagPatel14-Apr-09 3:56
ParagPatel14-Apr-09 3:56 

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.