title: Stopping Thread
body: <p>I have an application having a thread which runs continously,writing to a file.And it should terminate on a button click.But this results in flooding of Exceptions which forces the application to terminate.I tried using stop() function,but that doesn't work.Can any one suggest a method(code if possible) to safely terminate the thread and close the file.</p>