Move thread area allocate out of thread function into main thread. Signed-off-by: Xu Jun <xujunzz@sjtu.edu.cn>