What's TLS?
TLS is Thread Local.
Storage. Three types of variables are supported for TLS threads: local variables, local variables (TLS), and global variables. TLS differences: All threads use the same variable name or index
Access TLS variables, but the TLS variables of different threads are stored in different memory regions. In short, it is the same name and different storage.
For example, if there is a TLS variable errno, each thread executes the same statement "errno = I;" and errno has different values under different threads. Note that this does not declare a variable named errno in every thread. This is the convenience of TLS.
.
how to enable TLS?
If you wocould like to enable it, kernel config will now get new entry:
config_has_tls_reg = Y
rebuild the kernel and apply patch: 'android-enable-tls.patch '
the attached patch contains the experimental changes to enable TLS in
userspace (Android bionic and frameworks/base ).