-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[SR-6420] Ensure that the pthread_key is initialised once #1325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci please test |
How are we calling |
The table is a thread-local, so it is called once per thread. If you submit many async dispatch blocks that trigger a CF code path, this table gets assigned as a thread local per dispatch worker thread. |
Need to check under the load test that found this problem that it resolves the issue. Please hold off merging until then. |
If we're calling |
And that is the only place we call the |
You’ll note that there is a call to this inside the same file on line 666 which is the one causing the duplicate calls. |
You're right; that's different than the Darwin Foundation. I think the right solution here is actually just to delete the call from CFPlatform.c. |
That is unless somehow this call happens before __CFInitialize, but I hope not. That's supposed to be first. |
Will have a look next week to see why the call is there. It may have been added because the CFInitialize wasn’t being called first, and so this was added as a workaround. Or it may be unnecessary. We have a test case that can verify either solution so will get to that on Monday. |
@parkera the change (adding the initialize) was dropped into a mega-drop in a455cde by @phausler last year. Given that this patch allows the call to happen at most once per process, I'm going to merge this as is, and then maybe @phausler knows why the call to adding the initialize was required subsequently. |
@swift-ci please test and merge |
I'm not happy at all about merging this without getting to the root cause. |
No description provided.