Page MenuHomePhabricator

D3911.id12464.diff
No OneTemporary

D3911.id12464.diff

diff --git a/services/lib/src/ReactorUtility.h b/services/lib/src/ReactorUtility.h
new file mode 100644
--- /dev/null
+++ b/services/lib/src/ReactorUtility.h
@@ -0,0 +1,39 @@
+#pragma once
+
+#include <grpcpp/grpcpp.h>
+
+#include <atomic>
+#include <mutex>
+
+namespace comm {
+namespace network {
+namespace reactor {
+
+enum class ReactorState {
+ NONE = 0,
+ RUNNING = 1,
+ TERMINATED = 2,
+ DONE = 3,
+};
+
+class ReactorStatusHolder {
+private:
+ grpc::Status status = grpc::Status::OK;
+ std::mutex statusAccessMutex;
+
+public:
+ std::atomic<ReactorState> state = ReactorState::NONE;
+
+ grpc::Status getStatus() {
+ const std::unique_lock<std::mutex> lock(this->statusAccessMutex);
+ return this->status;
+ }
+ void setStatus(const grpc::Status &status) {
+ const std::unique_lock<std::mutex> lock(this->statusAccessMutex);
+ this->status = status;
+ }
+};
+
+} // namespace reactor
+} // namespace network
+} // namespace comm

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 26, 3:03 AM (9 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2703706
Default Alt Text
D3911.id12464.diff (961 B)

Event Timeline