Click here to Skip to main content
15,895,256 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: RE: how to run C++ code on linux Pin
Stuart Dootson17-May-09 23:27
professionalStuart Dootson17-May-09 23:27 
GeneralRe: RE: how to run C++ code on linux Pin
savitha87k21-May-09 2:44
savitha87k21-May-09 2:44 
GeneralRe: RE: how to run C++ code on linux Pin
Stuart Dootson21-May-09 2:49
professionalStuart Dootson21-May-09 2:49 
GeneralRe: RE: how to run C++ code on linux Pin
savitha87k21-May-09 3:06
savitha87k21-May-09 3:06 
GeneralRe: RE: how to run C++ code on linux Pin
Stuart Dootson21-May-09 3:16
professionalStuart Dootson21-May-09 3:16 
GeneralRe: RE: how to run C++ code on linux Pin
savitha87k21-May-09 3:27
savitha87k21-May-09 3:27 
GeneralRe: RE: how to run C++ code on linux Pin
Stuart Dootson21-May-09 4:33
professionalStuart Dootson21-May-09 4:33 
AnswerRe: RE: how to run C++ code on linux Pin
N a v a n e e t h17-May-09 22:29
N a v a n e e t h17-May-09 22:29 
GeneralRe: RE: how to run C++ code on linux Pin
savitha87k17-May-09 22:43
savitha87k17-May-09 22:43 
GeneralRe: RE: how to run C++ code on linux Pin
Rajesh R Subramanian17-May-09 22:49
professionalRajesh R Subramanian17-May-09 22:49 
GeneralRe: RE: how to run C++ code on linux Pin
CPallini17-May-09 22:51
mveCPallini17-May-09 22:51 
JokeRe: RE: how to run C++ code on linux Pin
Rajesh R Subramanian17-May-09 23:40
professionalRajesh R Subramanian17-May-09 23:40 
JokeYou cheater! Pin
CPallini17-May-09 23:51
mveCPallini17-May-09 23:51 
GeneralRe: RE: how to run C++ code on linux Pin
savitha87k17-May-09 22:57
savitha87k17-May-09 22:57 
GeneralRe: RE: how to run C++ code on linux Pin
savitha87k17-May-09 23:05
savitha87k17-May-09 23:05 
QuestionRe: RE: how to run C++ code on linux Pin
David Crow18-May-09 3:40
David Crow18-May-09 3:40 
QuestionSMART Support and SCSI Hard disk temperature. Pin
Abinash Mohanty17-May-09 20:25
Abinash Mohanty17-May-09 20:25 
AnswerRe: SMART Support and SCSI Hard disk temperature. Pin
C++myLife18-May-09 0:44
C++myLife18-May-09 0:44 
GeneralRe: SMART Support and SCSI Hard disk temperature. Pin
Abinash Mohanty18-May-09 1:15
Abinash Mohanty18-May-09 1:15 
Question880228 - taking time in handling stops responding Pin
ilostmyid217-May-09 20:16
professionalilostmyid217-May-09 20:16 
AnswerRe: 880228 - taking time in handling stops responding Pin
Stuart Dootson17-May-09 21:01
professionalStuart Dootson17-May-09 21:01 
AnswerRe: 880228 - taking time in handling stops responding Pin
norish17-May-09 21:29
norish17-May-09 21:29 
If your calculation is just a calculation and never refers any other resources,
I recommend the calculation is to be a thread and dialog button kickes start and stop only.
I figure it very simply like belows.

unsinged __stdcall calculation(void*)
{
 // start real calculation
}

void CMyDialog::OnStart() {
 m_threadHandle = (HANDLE)_beginthreadex(NULL, 0, calculation, NULL, 0, &m_threadId);
};

void CMyDialog::OnCancel() {
 if (m_threadHandle) {
  TerminateThread(m_threadHandle, 0x13);
  CloseHandle(m_threadHandle);
 }
};


Consider the calculation() must be thread-safe and makes no resource leaks.

If your calculation refers some other resources and should not be killed by TerminateThread(), another method is a stop flag refernce inside a loop.

like;
void calc(bool volatile f_stop) {
 for () {
  for () {
   for () {
    if (f_stop) goto exit_all_loop;
   }
  }
 }
exit_all_loop:
 // clean up all resources
}


The function calc() is to be well designed at a point of cleaning up and performance trade-off.
GeneralRe: 880228 - taking time in handling stops responding Pin
ilostmyid218-May-09 0:09
professionalilostmyid218-May-09 0:09 
AnswerRe: 880228 - taking time in handling stops responding Pin
norish18-May-09 0:33
norish18-May-09 0:33 
GeneralRe: 880228 - taking time in handling stops responding Pin
ilostmyid218-May-09 1:02
professionalilostmyid218-May-09 1:02 

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.