From 96d141bece8eea4b5a3a37f68da00428cfdc30f9 Mon Sep 17 00:00:00 2001 From: "gtm.daemon" Date: Wed, 20 Feb 2013 21:30:08 +0000 Subject: Only use dlsym on the Mac side as it's not necessary to take any performance hit at startup on the iOS side. DELTA=7 (7 added, 0 deleted, 0 changed) --- Foundation/GTMNSThread+Blocks.m | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Foundation/GTMNSThread+Blocks.m') diff --git a/Foundation/GTMNSThread+Blocks.m b/Foundation/GTMNSThread+Blocks.m index a3941fb..2476ad5 100644 --- a/Foundation/GTMNSThread+Blocks.m +++ b/Foundation/GTMNSThread+Blocks.m @@ -57,7 +57,12 @@ // Only available 10.6 and later. typedef int (*PThreadSetNameNPPTr)(const char*); +#if !GTM_IPHONE_SDK static PThreadSetNameNPPTr gPThreadSetNameNP = NULL; +#else +// Defined on iPhone since 3.2 +static PThreadSetNameNPPTr gPThreadSetNameNP = pthread_setname_np; +#endif // !GTM_IPHONE_SDK enum { kGTMSimpleThreadInitialized = 0, @@ -69,12 +74,14 @@ enum { @implementation GTMSimpleWorkerThread +#if !GTM_IPHONE_SDK + (void)initialize { if (self == [GTMSimpleWorkerThread class]) { // Resolve pthread_setname_np() on 10.6 and later. gPThreadSetNameNP = dlsym(RTLD_DEFAULT, "pthread_setname_np"); } } +#endif // !GTM_IPHONE_SDK - (id)init { if ((self = [super init])) { -- cgit v1.2.3