szaszm commented on code in PR #1568:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1568#discussion_r1187532598
##########
libminifi/include/FlowController.h:
##########
@@ -149,6 +149,34 @@ class FlowController : public
core::controller::ForwardingControllerServiceProvi
std::map<std::string, std::unique_ptr<io::InputStream>> getDebugInfo()
override;
private:
+ class UpdateState {
+ class UpdateLock;
+ public:
+ UpdateLock getUpdateLock() { return UpdateLock(*this); }
+ bool isUpdating() const { return update_block_count_ > 0; }
+
+ private:
+ class UpdateLock {
+ public:
+ UpdateLock(UpdateState& update_state) : update_state_(update_state) {
+ update_state_.beginUpdate();
+ }
+
+ ~UpdateLock() {
+ update_state_.endUpdate();
+ }
+ private:
+ UpdateState& update_state_;
+ };
+
Review Comment:
Please check the rule of 5 for this class. I think copying the object will
result in double decrease and underflowing update count.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]