Use a lock while outputting for a server