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
_______________________________________________
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev

Reply via email to