add thread synchronize before memcpy