> On Aug 18, 2015, at 9:29 AM, Maxthon Chan <m...@maxchan.info> wrote:
> 
> Two questions:
> 
> 1) How good will a Mac hold up as a server? I can serve static content from 
> the CDN I rented but CGIKit code is dynamic stuff. If a Mac and OS X holds 
> well, I can throw Linux compatibility out of the window and use GCD as I will.
> 2) If a Mac does not fare well as a server, I will have to make sure my code 
> is compatible with GNUstep which is the best Cocoa clone for Linux I have 
> encountered so far - complete with ARC and Blocks but GCD support on GNUstep 
> is poor (and CoreFoundation support is spotty) so I have to avoid using GCD 
> completely and use CoreFoundation only sparsely.

Apple's Objective-C runtime provides thread-safety guarantees for +initialize. 
If you are on some other platform then you should check if that platform 
provides similar guarantees.

dispatch_once() is the best solution on Apple's platforms. 

If you don't like dispatch_once() then you could use pthread_once(). 

If you don't like dispatch_once() nor pthread_once() then you can use 
PTHREAD_MUTEX_INITIALIZER instead of pthread_mutex_init(). That avoids any 
questions of +initialize thread-safety.


-- 
Greg Parker     gpar...@apple.com     Runtime Wrangler



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to