Use TLS variables instead of pthread specific interface

Registered by Alexey Kopytov

We should make use of the TLS mechanism provided by some compilers and platforms (notably GCC on Linux) instead of the slow pthread specific interface.

Current users of thread-local variables:
- current_thd
- my_errno
- sql_alloc
- performance schema
- threadpool

References:
- http://gcc.gnu.org/onlinedocs/gcc/Thread_002dLocal.html#Thread_002dLocal
- https://blogs.oracle.com/seongbae/entry/pthread_get_set_specific_vs
- http://www.airs.com/blog/archives/44

Blueprint information

Status:
Not started
Approver:
None
Priority:
Medium
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
Approved
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.