added more multithreaded tests that are useful with tsan

Also made various small cleanups while writing and checking these tests.
diff --git a/aos/common/util/util.gyp b/aos/common/util/util.gyp
index 7c0adf3..fb29d7f 100644
--- a/aos/common/util/util.gyp
+++ b/aos/common/util/util.gyp
@@ -20,6 +20,7 @@
         'run_command',
         '<(EXTERNALS):gtest',
         '<(AOS)/build/aos.gyp:logging',
+        'thread',
       ],
     },
     {