Client library: make MT-safe; add get_default_identity()