Remove race on cached thread-name deletion

Manage the thread name using an RCU-like scheme, in which the name
is an atomic pointer to an immutable string, and readers explicitly
maintain a count of active readers. Writers wait until there are
no readers before deallocating a name that was just replaced.

Currently this potentially blocks writers, but readers should be very
fast, and relatively infrequent, so I can't imagine this is a real
issue.

This also replaces JVM_SetNativeThreadName with a stub. This part of
the CL came from Nicolas' aosp/1706702, which this is otherwise
intended to replace.

Test: Build and boot AOSP.
Bug: 37970289
Change-Id: I7e1d13d24adc10b4009d60ee68bc9e837ce78b34
4 files changed