Re: API for fetching the computer name in cocoa
Re: API for fetching the computer name in cocoa
- Subject: Re: API for fetching the computer name in cocoa
- From: Michael Ash <email@hidden>
- Date: Fri, 12 Jun 2009 13:05:21 -0400
On Fri, Jun 12, 2009 at 12:44 PM, Eric Schlegel<email@hidden> wrote:
>
> On Jun 12, 2009, at 7:14 AM, Adam R. Maxwell wrote:
>
>> There is also NSHost, which has -name and -names.
>
> However, be aware that [[NSHost currentHost] name] can block for an
> exceedingly long time, so if you use it, always call it on a thread; and
> some of other API recommended here, such as SCDynamicStoreCopyComputerName,
> is probably a better choice.
NSHost is documented as not being thread safe, so you must never call
it on a thread.
You're right as well, of course, which means that the logical
conclusion is that you must never use it at all, ever.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden