Rename timer `Setup` function to `Schedule`
This patch was motivated by my desire to fix a typo in the function
name. The noun "setup" is 1 word. The verb "set up" is 2 words. All
other member functions are verbs, so this one should be a verb too.
That means that the function should be called `SetUp`. During the
discussion that resulted from the rename, James Kuszmaul pointed out
that "setting up" a timer can be confusing. It implies that you can
only "set up" a timer once. But the intent is to let users set up
timers as many times as they like. So we decided on renaming the
function to `Schedule`. That conveys the purpose and intent better.
I took this opportunity to fix some other typos involving the verb
"set up".
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I2f557d1f946960af82711f248820d5e2d385a5d3
diff --git a/aos/events/logging/realtime_replay_test.cc b/aos/events/logging/realtime_replay_test.cc
index a04da49..8c7751e 100644
--- a/aos/events/logging/realtime_replay_test.cc
+++ b/aos/events/logging/realtime_replay_test.cc
@@ -110,7 +110,7 @@
shm_event_loop.MakeFetcher<examples::Ping>("/test");
shm_event_loop.AddTimer([]() { LOG(INFO) << "Hello, World!"; })
- ->Setup(shm_event_loop.monotonic_now(), std::chrono::seconds(1));
+ ->Schedule(shm_event_loop.monotonic_now(), std::chrono::seconds(1));
shm_event_loop.Run();
reader.Deregister();
@@ -149,7 +149,7 @@
shm_event_loop.MakeFetcher<examples::Pong>("/test");
shm_event_loop.AddTimer([]() { LOG(INFO) << "Hello, World!"; })
- ->Setup(shm_event_loop.monotonic_now(), std::chrono::seconds(1));
+ ->Schedule(shm_event_loop.monotonic_now(), std::chrono::seconds(1));
// End timer should not be called in this case, it should automatically quit
// the event loop and check for number of fetches messages
@@ -165,8 +165,8 @@
});
shm_event_loop.OnRun([&shm_event_loop, end_timer, run_seconds]() {
LOG(INFO) << "Quitting in: " << run_seconds;
- end_timer->Setup(shm_event_loop.monotonic_now() +
- std::chrono::seconds(run_seconds));
+ end_timer->Schedule(shm_event_loop.monotonic_now() +
+ std::chrono::seconds(run_seconds));
});
shm_event_loop.Run();
@@ -213,7 +213,7 @@
shm_event_loop.MakeFetcher<examples::Ping>("/test");
shm_event_loop.AddTimer([]() { LOG(INFO) << "Hello, World!"; })
- ->Setup(shm_event_loop.monotonic_now(), std::chrono::seconds(1));
+ ->Schedule(shm_event_loop.monotonic_now(), std::chrono::seconds(1));
shm_event_loop.Run();
reader.Deregister();
@@ -262,7 +262,7 @@
shm_event_loop.MakeFetcher<examples::Ping>("/test");
shm_event_loop.AddTimer([]() { LOG(INFO) << "Hello, World!"; })
- ->Setup(shm_event_loop.monotonic_now(), std::chrono::seconds(1));
+ ->Schedule(shm_event_loop.monotonic_now(), std::chrono::seconds(1));
shm_event_loop.Run();
reader.Deregister();
@@ -321,8 +321,8 @@
size_t run_seconds = 3;
shm_event_loop.OnRun([&shm_event_loop, end_timer, run_seconds]() {
LOG(INFO) << "Quitting in: " << run_seconds;
- end_timer->Setup(shm_event_loop.monotonic_now() +
- std::chrono::seconds(run_seconds));
+ end_timer->Schedule(shm_event_loop.monotonic_now() +
+ std::chrono::seconds(run_seconds));
});
shm_event_loop.Run();