setting the terminate flag should wake the thread