diff options
author | Josh Blum | 2012-08-28 23:05:41 -0700 |
---|---|---|
committer | Josh Blum | 2012-08-28 23:05:41 -0700 |
commit | ac3857575c4c762f9a18ee18889740d4360a9aa8 (patch) | |
tree | 4526f5647f2e2d93c21d12ae3c524fb7991745b3 /lib/top_block.cpp | |
parent | 4044977deba6d64124763836d875b4da2b70eeaf (diff) | |
download | sandhi-ac3857575c4c762f9a18ee18889740d4360a9aa8.tar.gz sandhi-ac3857575c4c762f9a18ee18889740d4360a9aa8.tar.bz2 sandhi-ac3857575c4c762f9a18ee18889740d4360a9aa8.zip |
token work w/ messages to implement finite runs
Diffstat (limited to 'lib/top_block.cpp')
-rw-r--r-- | lib/top_block.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/top_block.cpp b/lib/top_block.cpp index 0ae4ce9..f9dde36 100644 --- a/lib/top_block.cpp +++ b/lib/top_block.cpp @@ -30,13 +30,12 @@ TopBlock::TopBlock(const std::string &name): tsbe::ExecutorConfig config; config.topology = (*this)->topology; (*this)->executor = tsbe::Executor(config); + (*this)->token = make_token(); } void TopBlock::update(void) { - TopBlockMessage event; - event.what = TopBlockMessage::UPDATE; - (*this)->executor.update(event); + this->start(); //ok to re-start, means update } void TopBlock::set_buffer_hint(const size_t hint) @@ -51,6 +50,7 @@ void TopBlock::start(void) { TopBlockMessage event; event.what = TopBlockMessage::ACTIVE; + event.token = (*this)->token; (*this)->executor.update(event); } @@ -61,7 +61,17 @@ void TopBlock::stop(void) (*this)->executor.update(event); } +void TopBlock::run(void) +{ + this->start(); + this->wait(); +} + void TopBlock::wait(void) { - //NOP/TODO? + while (not (*this)->token.unique()) + { + sleep(1); + VAR((*this)->token.use_count()); + } } |