Commit 5c8b2b3b authored by Dominik Charousset's avatar Dominik Charousset

Add is_stopped_flag and fix formatting

parent 91d22051
...@@ -51,6 +51,10 @@ public: ...@@ -51,6 +51,10 @@ public:
/// buffered elements. /// buffered elements.
static constexpr int is_shutting_down_flag = 0x0002; static constexpr int is_shutting_down_flag = 0x0002;
/// Denotes whether the manager has already stopped. Calling member functions
/// such as stop() or abort() on it no longer has any effect.
static constexpr int is_stopped_flag = 0x0004;
// -- member types ----------------------------------------------------------- // -- member types -----------------------------------------------------------
using inbound_paths_list = std::vector<inbound_path*>; using inbound_paths_list = std::vector<inbound_path*>;
...@@ -148,16 +152,21 @@ public: ...@@ -148,16 +152,21 @@ public:
return getf(is_shutting_down_flag); return getf(is_shutting_down_flag);
} }
/// Returns whether this manager has already stopped.
bool stopped() const noexcept {
return getf(is_stopped_flag);
}
/// Returns whether this stream remains open even if no in- or outbound paths /// Returns whether this stream remains open even if no in- or outbound paths
/// exist. The default is `false`. Does not keep a source alive past the /// exist. The default is `false`. Does not keep a source alive past the
/// point where its driver returns `done() == true`. /// point where its driver returns `done() == true`.
inline bool continuous() const noexcept { bool continuous() const noexcept {
return getf(is_continuous_flag); return getf(is_continuous_flag);
} }
/// Sets whether this stream remains open even if no in- or outbound paths /// Sets whether this stream remains open even if no in- or outbound paths
/// exist. /// exist.
inline void continuous(bool x) noexcept { void continuous(bool x) noexcept {
if (!shutting_down()) { if (!shutting_down()) {
if (x) if (x)
setf(is_continuous_flag); setf(is_continuous_flag);
...@@ -167,7 +176,7 @@ public: ...@@ -167,7 +176,7 @@ public:
} }
/// Returns the list of inbound paths. /// Returns the list of inbound paths.
inline const inbound_paths_list& inbound_paths() const noexcept{ const inbound_paths_list& inbound_paths() const noexcept {
return inbound_paths_; return inbound_paths_;
} }
...@@ -179,7 +188,7 @@ public: ...@@ -179,7 +188,7 @@ public:
bool inbound_paths_idle() const noexcept; bool inbound_paths_idle() const noexcept;
/// Returns the parent actor. /// Returns the parent actor.
inline scheduled_actor* self() { scheduled_actor* self() {
return self_; return self_;
} }
...@@ -265,7 +274,7 @@ public: ...@@ -265,7 +274,7 @@ public:
/// Adds the current sender as an inbound path. /// Adds the current sender as an inbound path.
/// @pre Current message is an `open_stream_msg`. /// @pre Current message is an `open_stream_msg`.
stream_slot add_unchecked_inbound_path_impl(rtti_pair rtti); stream_slot add_unchecked_inbound_path_impl(rtti_pair rtti);
protected: protected:
// -- modifiers for self ----------------------------------------------------- // -- modifiers for self -----------------------------------------------------
...@@ -322,9 +331,9 @@ private: ...@@ -322,9 +331,9 @@ private:
flags_ = x & ~flag; flags_ = x & ~flag;
} }
bool getf(int flag) const noexcept { bool getf(int flag) const noexcept {
return (flags_ & flag) != 0; return (flags_ & flag) != 0;
} }
}; };
/// A reference counting pointer to a `stream_manager`. /// A reference counting pointer to a `stream_manager`.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment