try to use static variable to control the thread's running but failed