[swift-corelibs-dev] Use of pthread_main_np() in NSOperation
Chris Bailey
BAILEYC at uk.ibm.com
Tue May 10 14:10:03 CDT 2016
NSOperation.swift currently makes a call to pthread_main_np() on line 536.
This causes a compilation failure on Linux as there isn't an
implementation of pthread_main_np() in Glibc.
There's few ways of fixing this. Before I go ahead and implement one of
them, I'd like to get some input on what we thing is the best approach.
The most obvious approach would be to leverage the shim we've added to
CoreFoundation already. We implemented pthread_main_np() using the
following function in CFPlatform.c:
Boolean _CFIsMainThread(void) {
return syscall(SYS_gettid) == getpid();
}
This is only available internally to CF, but could be exposed to
Foundation, either as _CFIsMainThread() or as pthread_main_np().
Other options would be to expose the pthread_main_np() shim that's in
Dispatch already (again internally), or to add it to the Glibc overlay so
its available globally.
Any thoughts on the best approach?
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-corelibs-dev/attachments/20160510/54877972/attachment.html>
More information about the swift-corelibs-dev
mailing list