Bug 15270 – use TLS to store Thread.getThis (pthread_getspecific causes heavy lock contention)

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2015-10-31T03:32:00Z
Last change time
2016-01-03T14:10:09Z
Assigned to
nobody
Creator
code

Comments

Comment #0 by code — 2015-10-31T03:32:35Z
Before 2.066 Thread.getThis() was stored in a plain TLS variable. In order to fix issue 11981 this was changed to use pthread_getspecific. Apparently this is a huge performance issue (see https://github.com/D-Programming-Language/druntime/pull/1419).
Comment #1 by github-bugzilla — 2015-10-31T16:34:05Z
Commits pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/e226ff2bd26b1941ddadfa0b30ca4f162901ab13 fix Issue 15270 - use TLS to store Thread.getThis - as signals are no longer send during thread startup we can use a TLS variable to store Thread.getThis() - make sure to set the variable (and probably trigger lazy TLS allocation) before adding the Thread to the global list https://github.com/D-Programming-Language/druntime/commit/c2c255ce0be5deacd2df61df5135769727983173 Merge pull request #1422 from MartinNowak/fix15670 fix Issue 15270 - use TLS to store Thread.getThis
Comment #2 by github-bugzilla — 2016-01-03T14:10:09Z