diff options
author | Josh Blum | 2013-03-16 04:18:37 -0700 |
---|---|---|
committer | Josh Blum | 2013-03-16 04:18:37 -0700 |
commit | cebd974738fea792f70bca8ab0bb1d73e2116d81 (patch) | |
tree | fe53f1ce5795385ac257430912ae2d9bc4129120 /lib/block.cpp | |
parent | 7cc848c9e69dd3c1f70e2872f1a4fb2043c94e66 (diff) | |
download | sandhi-cebd974738fea792f70bca8ab0bb1d73e2116d81.tar.gz sandhi-cebd974738fea792f70bca8ab0bb1d73e2116d81.tar.bz2 sandhi-cebd974738fea792f70bca8ab0bb1d73e2116d81.zip |
gras: added num_read count for pop msg to fix #53
Diffstat (limited to 'lib/block.cpp')
-rw-r--r-- | lib/block.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/block.cpp b/lib/block.cpp index 9bf3b9c..d2f0a0d 100644 --- a/lib/block.cpp +++ b/lib/block.cpp @@ -181,9 +181,9 @@ void Block::post_output_msg(const size_t which_output, const PMCC &msg) PMCC Block::pop_input_msg(const size_t which_input) { std::vector<PMCC> &input_msgs = (*this)->block->input_msgs[which_input]; - if (input_msgs.empty()) return PMCC(); - PMCC p = input_msgs.front(); - input_msgs.erase(input_msgs.begin()); + size_t &num_read = (*this)->block->num_input_msgs_read[which_input]; + if (num_read >= input_msgs.size()) return PMCC(); + PMCC p = input_msgs[num_read++]; (*this)->block->stats.msgs_consumed[which_input]++; return p; } |