Thread protection in the client