Change y2014 to absl::call_once
Change-Id: I7a4631af285f8fe92f6b986ee7f49f501ad50a5c
diff --git a/y2014/constants.cc b/y2014/constants.cc
index 19be8f9..a1b8d2a 100644
--- a/y2014/constants.cc
+++ b/y2014/constants.cc
@@ -13,7 +13,7 @@
#include "aos/logging/logging.h"
#include "aos/mutex/mutex.h"
#include "aos/network/team_number.h"
-#include "aos/once.h"
+#include "absl/base/call_once.h"
#include "y2014/control_loops/drivetrain/polydrivetrain_dog_motor_plant.h"
#include "y2014/control_loops/drivetrain/drivetrain_dog_motor_plant.h"
@@ -182,17 +182,20 @@
}
}
-const Values *DoGetValues() {
+void DoGetValues(const Values **result) {
uint16_t team = ::aos::network::GetTeamNumber();
AOS_LOG(INFO, "creating a Constants for team %" PRIu16 "\n", team);
- return DoGetValuesForTeam(team);
+ *result = DoGetValuesForTeam(team);
+ return;
}
} // namespace
const Values &GetValues() {
- static ::aos::Once<const Values> once(DoGetValues);
- return *once.Get();
+ static absl::once_flag once;
+ static const Values *result;
+ absl::call_once(once, DoGetValues, &result);
+ return *result;
}
const Values &GetValuesForTeam(uint16_t team_number) {