fixed lots of not-thread-safe things
Most of the things I fixed here were using libc functions that are
fundamentally not thread-safe.
diff --git a/aos/common/once_test.cc b/aos/common/once_test.cc
index 7c6e5de..3773b5b 100644
--- a/aos/common/once_test.cc
+++ b/aos/common/once_test.cc
@@ -1,7 +1,7 @@
#include "aos/common/once.h"
-#include "stdlib.h"
-#include "limits.h"
+#include <stdlib.h>
+#include <limits.h>
#include "gtest/gtest.h"
@@ -12,7 +12,7 @@
public:
static int *Function() {
++times_run_;
- value_ = rand() % INT_MAX;
+ value_ = 971 + times_run_;
return &value_;
}
@@ -94,7 +94,8 @@
int second_result = 0;
int *SecondFunction() {
- second_result = rand() % INT_MAX;
+ static int result = 254;
+ second_result = ++result;
return &second_result;
}