Skip to content

TLS: Thread Local Storage #82

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

Merged
merged 1 commit into from
Jun 21, 2016
Merged

TLS: Thread Local Storage #82

merged 1 commit into from
Jun 21, 2016

Conversation

frankeh
Copy link
Contributor

@frankeh frankeh commented Jun 16, 2016

Bring up previous patch for Thread Local Storage utilization over explicit keys to 685 base.

@@ -63,3 +64,8 @@ unsigned short dispatch_callout__return_semaphore;
unsigned short dispatch_queue__push_semaphore;
void (*_dispatch_block_special_invoke)(void*);
struct dispatch_queue_attr_s _dispatch_queue_attr_concurrent;

#if DISPATCH_USE_THREAD_LOCAL_STORAGE
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 move in init.c

@MadCoder
Copy link
Contributor

done with the first round of comments.

_dispatch_get_tsd_base(void)
{
if (slowpath(!__dispatch_tsd.initialized)) {
libdispatch_tsd_init();
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding a OS_COMPILER_CAN_ASSUME(__dispatch_tsd.tid != 0) may help clang to also not call that lazy init several times for the cases when several TSD accesses are performed

@frankeh
Copy link
Contributor Author

frankeh commented Jun 17, 2016

Besides the other two comments:
Moving the functions for libdispatch_tsd_cleanup to init.c requires that all the key specific cleanup functions that are static in queue.c now have to be externalized and prototypes need to be provided.
Is that really what you want ?

@frankeh
Copy link
Contributor Author

frankeh commented Jun 17, 2016

Finally DISPATCH_PURE on libdispatch_tsd_init results in crashes (verified with only that change).
So we didn't do that.

@MadCoder
Copy link
Contributor

ok we can keep libdispatch_tsd_cleanup() in queue.c then.
why did making it PURE crashes? that makes no sense to me (I believe you I'd just be interested to see a crash log)

@MadCoder
Copy link
Contributor

the patch looks good beside cleaning up gettid/_dispatch_thread_port which we'll do once the other request is merged. thanks

@MadCoder
Copy link
Contributor

I just merged #86 so please rebase, squash and address the remaining comments

@frankeh
Copy link
Contributor Author

frankeh commented Jun 20, 2016

Rebase squashed based on the comments you had left and we fixed. (thanx)

@MadCoder MadCoder merged commit 4fa8d8d into swiftlang:master Jun 21, 2016
@MadCoder
Copy link
Contributor

\o/

das pushed a commit that referenced this pull request Aug 11, 2016
TLS: Thread Local Storage

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
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