Simple question about running threads

I am pretty new at trying to use threads, but for someone with a little more experience this should be a very easy question to answer. In my application I have a method that runs a pretty intensive process. It is a pretty long method and has already been written. Now, if I start a new thread and in that thread I call this method, is this method running in a seperate thread or is it still being run by my application? Example:

void CTestDlg::Run()
{
  // A lot of processing here.
}

UINT CTestDlg::MyThread(LPVOID pParam)
{
     CTest* pView = (CTest*)pParam;
     pView->Run();
     return 0;
}

I am wondering because doing it this way my application window is pretty slow responding during the processing. I thought that running something as a seperate thread runs the function in the background and woudnt affect my application much, but I'm not sure if Run() is running as a seperate thread or if MyThread() is just calling Run() and my application is still doing all of that processing. Can anyone answer this for me? Thanks.

cheapstrAsked:
Who is Participating?
 
AndyAinscowFreelance programmer / ConsultantCommented:
What you have done is to create a separate thread that then instructs the MAIN thread to do the work in 'Run'.  That is why it is sluggish.
You need to do the work in the thread (MyThread)
0
 
cheapstrAuthor Commented:
That's what I was wondering. Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.