Skip to content

Conversation

@seabaylea
Copy link
Contributor

NSOperation.currentQueue() makes a call to pthread_main_np(), which isn't supported on Linux. There's already a shim in CoreFoundation that implements the function under _CFIsMainThread(), so this PR:

  1. Externalizes _CFIsMainThread()
  2. Imports CoreFoundation and creates a pthread_main_np function that calls it

The implementation of the pthread_main_np() function in NSOperation is done as a top level function - that's probably not the right thing to do, but it allows it to be groups with the import of CoreFoundation, which is only required to expose _CFIsMainThread(). This way its a little more clear why the function is there, and makes it easier to clean up the code if we implement the pthread_main_np() shim a better way.

CF_EXPORT
int _CFIsMainThread(void);
#endif

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go into ForSwiftFoundationOnly.h.

@seabaylea seabaylea force-pushed the dispatch-nsoperation branch from a365d94 to df10e93 Compare May 15, 2016 18:35
@seabaylea
Copy link
Contributor Author

@parkera Thanks for the review. I've made the changes requested.

@parkera
Copy link
Contributor

parkera commented May 16, 2016

@swift-ci please test

@parkera parkera merged commit 523dffa into swiftlang:master May 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants