diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2013-02-20 21:30:08 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2013-02-20 21:30:08 +0000 |
commit | 96d141bece8eea4b5a3a37f68da00428cfdc30f9 (patch) | |
tree | 3bd4dde6eaf261de2a6c4f5ec629b6de6ae4ffe5 /Foundation/GTMNSThread+Blocks.m | |
parent | e87795d0d15fd8b725b2e4899275aa713d39e9e3 (diff) |
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)
Diffstat (limited to 'Foundation/GTMNSThread+Blocks.m')
-rw-r--r-- | Foundation/GTMNSThread+Blocks.m | 7 |
1 files changed, 7 insertions, 0 deletions
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])) { |