View Single Post
Old 2008-04-05, 17:53   #1 (permalink)
hbe02
Portal Member
 
Join Date: Apr 2008
Posts: 26
Thanks: 2
Thanked 1 Time in 1 Post

Country:


Default Thread in Plugin not Closing

Hi all, Im running a thread in a plugin im making, i want this thread to keep running even when the user switches to another screen. But i also want the thread to be terminated when the user Exits Media Portal.
Right now its working perfectly, but when i exit media portal i still have a thread under "Media Portal" in the running processes under CTRL+ALT+DEL.
I declared the thread as follows:
Code:
ListeningProgram = new Thread(commandsHandler);
            ListeningProgram.Start();
commands handler is a funciton that contains an infinite loop.

So basicly my question is, where do i put the statement:
Code:
ListeningProgram.Abort();
Since i want the thread to keep running even when the user switches to another screen, i assume that i cannot abort the thread in the:
Code:
virtual void OnPageDestroy(int newWindowId)
thanks :-D
hbe02 is offline   Reply With Quote