Fix a race condition in persistent memory allocator unit test

The PersistentMemoryAllocatorTest.IteratorParallelismTest unit
test gets stuck on a thread's Join() call when run on
brilloemulator-arm.  This appears to be due to a race condition
in the thread setting up its lock and waiting on the condition
variable, and the parent thread issuing the Signal() chain that
is meant to wake up the children threads.  Add in an autolock in
the main thread and a conditional bool around the threads' call
to Wait() to prevent any threads from calling Wait() after the
main thread has already sent the signal.

Bug: 30183753
Test: `libchrome_test` passes on brilloemulator-arm

Change-Id: Ief955ed8d94c9264e6d3cbbfaad637a1c5fade02
1 file changed