[scudo] Refactor initialization of TSDs. (#169738)

Instead of getting a lock and then checking/modifying the Initialization
variable, make it an atomic. Doing this, we can remove one of the
mutexes in shared TSDs and avoid any potential lock contention in both
shared TSDs and exclusive TSDs if multiple threads do allocation
operations at the same time.

Add two new tests that make sure no crashes occur if multiple threads
try and do allocations at the same time.

NOKEYCHECK=True
GitOrigin-RevId: 64ee4bf73411d1462fec0c2c2b5c44aaaa3a1903
3 files changed