for multithread.