multi pthread optimize