Syncronizing thread destruction?
-
Hi Everyone, I have an application that has a thread within a thread. When I delete the parent it is suppose to delete the child thread within the destructor. Unforetunately I am running into problems where the memory has already been freed (at least that is what I think has happened) and trying to free the resources are used by the threads. When I run the application through boundschecker I don't see this problem at all so I think it has to do with some race condition. Is there some documentation on how to properly and effectively control the destruction of threads? Cheers, Clint
-
Hi Everyone, I have an application that has a thread within a thread. When I delete the parent it is suppose to delete the child thread within the destructor. Unforetunately I am running into problems where the memory has already been freed (at least that is what I think has happened) and trying to free the resources are used by the threads. When I run the application through boundschecker I don't see this problem at all so I think it has to do with some race condition. Is there some documentation on how to properly and effectively control the destruction of threads? Cheers, Clint
What do you mean by "delete" the thread? The parent thread should ask the child thread to end, and then it should end. Using CEvent is a good way to do this. Neville Franks, Author of ED for Windows. www.getsoft.com Make money with our new Affilate program
-
Hi Everyone, I have an application that has a thread within a thread. When I delete the parent it is suppose to delete the child thread within the destructor. Unforetunately I am running into problems where the memory has already been freed (at least that is what I think has happened) and trying to free the resources are used by the threads. When I run the application through boundschecker I don't see this problem at all so I think it has to do with some race condition. Is there some documentation on how to properly and effectively control the destruction of threads? Cheers, Clint
-
I was using an user interface thread to do the trick. I changed over to a worker thread and now everything seems to be better. I think the problem had to do with the self deleting nature of user threads. Now I explicitly control who deletes and when. Sincerly, Clint