crydev Messages: 151 Registered: October 2012 Location: Netherlands
Experienced Member
I have the same problem and I am looking for a solution. I tried the things posted here but I cannot solve the problem. My problem is that my program will always be using only 1 thread for the operation needed. (meaning GUI + 1 extra thread) Besides that, my thread performs tasks located in another class which are called by one main function. I don't have any blocking threads so using loops and volatile variables will not get me any further I think.
My code is as following:
void ButtonClicked() // This function is the button event
{
Thread().Run(THISBACK1(RunImdbSearchAsync, row));
}
void RunImdbSearchAsync(int row) // Thread tasks
{
ImdbManager im;
im.WhenImdbMovie = THISBACK(ImdbMovieFound);
im.ImdbSearch(mMovieList.Get(row, 0)); // This is a function that wraps around three tasks:
// 1. Retrieving HTML using HttpRequest;
// 2. Parsing HTML using Regular Expression;
// 3. Creating an object containing the parsed data and returning it.
PostCallback(THISBACK(AfterImdbSearch));
}
What would help for my situation? When I click the red cross to close my application while the thread above is still running I get an access violation.