Commit d06a82f0 by Winter

dataflow_cpp: removed debug code from Action, changed done sync to atomics

parent 2f7e8112
...@@ -39,29 +39,22 @@ namespace internal { ...@@ -39,29 +39,22 @@ namespace internal {
class Action { class Action {
public: public:
Action() : node_(NULL), clock_(0), pending_(0) {} Action() : node_(NULL), clock_(0) {}
Action(Node * node, int clock) : node_(node), clock_(clock), pending_(2) {} Action(Node * node, int clock) : node_(node), clock_(clock) {}
void RunSequential() { void RunSequential() {
pending_ = 1;
node_->Run(clock_); node_->Run(clock_);
pending_ = 0;
} }
void RunMTAPI(embb::tasks::TaskContext & /*context*/) { void RunMTAPI(embb::tasks::TaskContext & /*context*/) {
pending_ = 1;
node_->Run(clock_); node_->Run(clock_);
pending_ = 0;
} }
bool IsPending() const { return pending_ > 0; }
int GetClock() const { return clock_; } int GetClock() const { return clock_; }
private: private:
Node * node_; Node * node_;
int clock_; int clock_;
volatile int pending_;
}; };
} // namespace internal } // namespace internal
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#ifndef EMBB_DATAFLOW_INTERNAL_SOURCE_H_ #ifndef EMBB_DATAFLOW_INTERNAL_SOURCE_H_
#define EMBB_DATAFLOW_INTERNAL_SOURCE_H_ #define EMBB_DATAFLOW_INTERNAL_SOURCE_H_
#include <embb/base/atomic.h>
#include <embb/dataflow/internal/node.h> #include <embb/dataflow/internal/node.h>
#include <embb/dataflow/internal/outputs.h> #include <embb/dataflow/internal/outputs.h>
#include <embb/dataflow/internal/source_executor.h> #include <embb/dataflow/internal/source_executor.h>
...@@ -88,7 +90,7 @@ class Source< Slices, Outputs<Slices, O1, O2, O3, O4, O5> > ...@@ -88,7 +90,7 @@ class Source< Slices, Outputs<Slices, O1, O2, O3, O4, O5> >
private: private:
OutputsType outputs_; OutputsType outputs_;
ExecutorType executor_; ExecutorType executor_;
volatile bool not_done_; embb::base::Atomic<bool> not_done_;
}; };
} // namespace internal } // namespace internal
......
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 sign in to comment