Reland "Fix a race when dumping thread list for tracing"

This reverts commit b51bdccb0b44b1aa9295bd3de03dbe98c7fbfa0f.

Reason for revert: Reland after fixing failures.
We might update thread information more than once when thread detach and
stopping the trace race. It is okay to update the information twice, so
just use Overwrite instead of Put to update the SafeMap.

Bug: 275117853
Test: art/test.py -t 2246
Change-Id: I51fc976a85828311fb031eca65d21da201ce9ab6
5 files changed