Ensure that updates to the global event mask are atomic

We were setting and testing the global event mask in a way that
allowed races with other threads. This could cause issues if multiple
threads write to the mask at the same time and could cause changes to
the current event state to be missed.

Test: ./test.py --host -j50
Bug: 69657830
Change-Id: I5e2759af598e6179fd25fcbe6b211a9369217156
2 files changed