Move event.h into ipc_lib
Makes tab completion a lot less annoying.
Change-Id: I0c905ba112c274d23b5f0277b9a5c2a8e4e238f6
diff --git a/aos/BUILD b/aos/BUILD
index 8e2d8ac..b87f7bc 100644
--- a/aos/BUILD
+++ b/aos/BUILD
@@ -146,38 +146,6 @@
],
)
-cc_library(
- name = "event",
- srcs = [
- "event.cc",
- ],
- hdrs = [
- "event.h",
- ],
- target_compatible_with = ["@platforms//os:linux"],
- visibility = ["//visibility:public"],
- deps = [
- "//aos/ipc_lib:aos_sync",
- "//aos/time",
- "//aos/type_traits",
- "@com_github_google_glog//:glog",
- ],
-)
-
-cc_test(
- name = "event_test",
- srcs = [
- "event_test.cc",
- ],
- target_compatible_with = ["@platforms//os:linux"],
- deps = [
- ":event",
- "//aos/testing:googletest",
- "//aos/testing:test_logging",
- "//aos/time",
- ],
-)
-
cc_binary(
name = "dump_rtprio",
srcs = [
diff --git a/aos/actions/BUILD b/aos/actions/BUILD
index 0cc5e12..25c439d 100644
--- a/aos/actions/BUILD
+++ b/aos/actions/BUILD
@@ -70,7 +70,6 @@
":actions_fbs",
":test_action2_fbs",
":test_action_fbs",
- "//aos:event",
"//aos/events:simulated_event_loop",
"//aos/logging",
"//aos/testing:googletest",
diff --git a/aos/ipc_lib/BUILD b/aos/ipc_lib/BUILD
index 7799cdc..026f866 100644
--- a/aos/ipc_lib/BUILD
+++ b/aos/ipc_lib/BUILD
@@ -100,8 +100,8 @@
linkopts = ["-lrt"],
target_compatible_with = ["@platforms//os:linux"],
deps = [
+ ":event",
"//aos:condition",
- "//aos:event",
"//aos:init",
"//aos/logging",
"//aos/logging:implementations",
@@ -194,8 +194,8 @@
],
target_compatible_with = ["@platforms//os:linux"],
deps = [
+ ":event",
":lockless_queue",
- "//aos:event",
"//aos/testing:googletest",
],
)
@@ -206,10 +206,10 @@
srcs = ["lockless_queue_test.cc"],
target_compatible_with = ["@platforms//os:linux"],
deps = [
+ ":event",
":lockless_queue",
":queue_racer",
":signalfd",
- "//aos:event",
"//aos/events:epoll",
"//aos/testing:googletest",
"//aos/testing:prevent_exit",
@@ -221,10 +221,10 @@
srcs = ["lockless_queue_death_test.cc"],
target_compatible_with = ["@platforms//os:linux"],
deps = [
+ ":event",
":lockless_queue",
":queue_racer",
":signalfd",
- "//aos:event",
"//aos/events:epoll",
"//aos/libc:aos_strsignal",
"//aos/testing:googletest",
@@ -326,3 +326,35 @@
":lockless_queue",
],
)
+
+cc_library(
+ name = "event",
+ srcs = [
+ "event.cc",
+ ],
+ hdrs = [
+ "event.h",
+ ],
+ target_compatible_with = ["@platforms//os:linux"],
+ visibility = ["//visibility:public"],
+ deps = [
+ "//aos/ipc_lib:aos_sync",
+ "//aos/time",
+ "//aos/type_traits",
+ "@com_github_google_glog//:glog",
+ ],
+)
+
+cc_test(
+ name = "event_test",
+ srcs = [
+ "event_test.cc",
+ ],
+ target_compatible_with = ["@platforms//os:linux"],
+ deps = [
+ ":event",
+ "//aos/testing:googletest",
+ "//aos/testing:test_logging",
+ "//aos/time",
+ ],
+)
diff --git a/aos/event.cc b/aos/ipc_lib/event.cc
similarity index 94%
rename from aos/event.cc
rename to aos/ipc_lib/event.cc
index 1b60362..940dfbd 100644
--- a/aos/event.cc
+++ b/aos/ipc_lib/event.cc
@@ -1,4 +1,4 @@
-#include "aos/event.h"
+#include "aos/ipc_lib/event.h"
#include <chrono>
@@ -51,8 +51,6 @@
}
}
-bool Event::Clear() {
- return !futex_unset(&impl_);
-}
+bool Event::Clear() { return !futex_unset(&impl_); }
} // namespace aos
diff --git a/aos/event.h b/aos/ipc_lib/event.h
similarity index 95%
rename from aos/event.h
rename to aos/ipc_lib/event.h
index a49dffa..d8440e8 100644
--- a/aos/event.h
+++ b/aos/ipc_lib/event.h
@@ -1,9 +1,8 @@
-#ifndef AOS_EVENT_H_
-#define AOS_EVENT_H_
-
-#include "aos/time/time.h"
+#ifndef AOS_IPC_LIB_EVENT_H_
+#define AOS_IPC_LIB_EVENT_H_
#include "aos/ipc_lib/aos_sync.h"
+#include "aos/time/time.h"
namespace aos {
@@ -57,4 +56,4 @@
} // namespace aos
-#endif // AOS_EVENT_H_
+#endif // AOS_IPC_LIB_EVENT_H_
diff --git a/aos/event_test.cc b/aos/ipc_lib/event_test.cc
similarity index 95%
rename from aos/event_test.cc
rename to aos/ipc_lib/event_test.cc
index 7fe573d..fb2421e 100644
--- a/aos/event_test.cc
+++ b/aos/ipc_lib/event_test.cc
@@ -1,12 +1,11 @@
-#include "aos/event.h"
+#include "aos/ipc_lib/event.h"
#include <chrono>
#include <thread>
-#include "gtest/gtest.h"
-
-#include "aos/time/time.h"
#include "aos/testing/test_logging.h"
+#include "aos/time/time.h"
+#include "gtest/gtest.h"
namespace aos {
namespace testing {
@@ -19,9 +18,7 @@
Event test_event_;
protected:
- void SetUp() override {
- ::aos::testing::EnableTestLogging();
- }
+ void SetUp() override { ::aos::testing::EnableTestLogging(); }
};
// Makes sure that basic operations with no blocking or anything work.
diff --git a/aos/ipc_lib/ipc_comparison.cc b/aos/ipc_lib/ipc_comparison.cc
index cf19b20..af1098d 100644
--- a/aos/ipc_lib/ipc_comparison.cc
+++ b/aos/ipc_lib/ipc_comparison.cc
@@ -1,5 +1,3 @@
-#include "gflags/gflags.h"
-
#include <fcntl.h>
#include <mqueue.h>
#include <netinet/in.h>
@@ -22,13 +20,14 @@
#include <thread>
#include "aos/condition.h"
-#include "aos/event.h"
#include "aos/init.h"
+#include "aos/ipc_lib/event.h"
#include "aos/logging/implementations.h"
#include "aos/logging/logging.h"
#include "aos/mutex/mutex.h"
#include "aos/realtime.h"
#include "aos/time/time.h"
+#include "gflags/gflags.h"
DEFINE_string(method, "", "Which IPC method to use");
DEFINE_int32(messages, 1000000, "How many messages to send back and forth");
diff --git a/aos/ipc_lib/lockless_queue_test.cc b/aos/ipc_lib/lockless_queue_test.cc
index 6510501..a90b976 100644
--- a/aos/ipc_lib/lockless_queue_test.cc
+++ b/aos/ipc_lib/lockless_queue_test.cc
@@ -4,14 +4,15 @@
#include <signal.h>
#include <unistd.h>
#include <wait.h>
+
#include <chrono>
#include <memory>
#include <random>
#include <thread>
-#include "aos/event.h"
#include "aos/events/epoll.h"
#include "aos/ipc_lib/aos_sync.h"
+#include "aos/ipc_lib/event.h"
#include "aos/ipc_lib/queue_racer.h"
#include "aos/ipc_lib/signalfd.h"
#include "aos/realtime.h"
@@ -127,8 +128,7 @@
alignof(LocklessQueueWatcher)>::type data;
new (&data)
LocklessQueueWatcher(LocklessQueueWatcher::Make(queue(), 5).value());
- })
- .join();
+ }).join();
EXPECT_EQ(wake_upper.Wakeup(7), 0);
}
diff --git a/aos/ipc_lib/queue_racer.cc b/aos/ipc_lib/queue_racer.cc
index fcc8668..5b3d88b 100644
--- a/aos/ipc_lib/queue_racer.cc
+++ b/aos/ipc_lib/queue_racer.cc
@@ -2,9 +2,10 @@
#include <inttypes.h>
#include <string.h>
+
#include <limits>
-#include "aos/event.h"
+#include "aos/ipc_lib/event.h"
#include "gtest/gtest.h"
namespace aos {
diff --git a/aos/network/BUILD b/aos/network/BUILD
index 3cb5c26..e42552d 100644
--- a/aos/network/BUILD
+++ b/aos/network/BUILD
@@ -340,11 +340,11 @@
deps = [
":message_bridge_client_lib",
":message_bridge_server_lib",
- "//aos:event",
"//aos:json_to_flatbuffer",
"//aos/events:ping_fbs",
"//aos/events:pong_fbs",
"//aos/events:shm_event_loop",
+ "//aos/ipc_lib:event",
"//aos/testing:googletest",
],
)
diff --git a/aos/network/message_bridge_test.cc b/aos/network/message_bridge_test.cc
index a9e918b..ca5bcb8 100644
--- a/aos/network/message_bridge_test.cc
+++ b/aos/network/message_bridge_test.cc
@@ -1,16 +1,15 @@
-#include "gtest/gtest.h"
-
#include <chrono>
#include <thread>
#include "absl/strings/str_cat.h"
-#include "aos/event.h"
#include "aos/events/ping_generated.h"
#include "aos/events/pong_generated.h"
+#include "aos/ipc_lib/event.h"
#include "aos/network/message_bridge_client_lib.h"
#include "aos/network/message_bridge_server_lib.h"
#include "aos/network/team_number.h"
#include "aos/util/file.h"
+#include "gtest/gtest.h"
namespace aos {
void SetShmBase(const std::string_view base);