modified functions of MyThread.cpp