for multi-thread