support parallel running by threads.