diff options
author | Josh Blum | 2012-09-11 01:27:19 -0700 |
---|---|---|
committer | Josh Blum | 2012-09-11 01:27:19 -0700 |
commit | 02f896e5a66575df4f16593584a7bc6892adf81c (patch) | |
tree | 80747cddeddfebfe4fa6f5db6af2625866b4ce63 /lib/top_block.cpp | |
parent | 053d2f5cdbb4027d65aa7cb8af851a9edeac1d0a (diff) | |
download | sandhi-02f896e5a66575df4f16593584a7bc6892adf81c.tar.gz sandhi-02f896e5a66575df4f16593584a7bc6892adf81c.tar.bz2 sandhi-02f896e5a66575df4f16593584a7bc6892adf81c.zip |
work on interruptible_thread
Diffstat (limited to 'lib/top_block.cpp')
-rw-r--r-- | lib/top_block.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/top_block.cpp b/lib/top_block.cpp index c681859..440b7fa 100644 --- a/lib/top_block.cpp +++ b/lib/top_block.cpp @@ -32,6 +32,7 @@ TopBlock::TopBlock(const std::string &name): config.topology = (*this)->topology; (*this)->executor = tsbe::Executor(config); (*this)->token = Token::make(); + (*this)->thread_group = SharedThreadGroup(new boost::thread_group()); if (GENESIS) std::cout << "===================================================\n" << "== Top Block Created: " << name << "\n" @@ -68,6 +69,9 @@ void TopBlock::start(void) { (*this)->executor.commit(); { + (*this)->executor.post_msg((*this)->thread_group); + } + { TopBlockMessage event; event.what = TopBlockMessage::TOKEN_TIME; event.token = (*this)->token; @@ -87,6 +91,7 @@ void TopBlock::start(void) void TopBlock::stop(void) { + (*this)->thread_group->interrupt_all(); TopBlockMessage event; event.what = TopBlockMessage::INERT; (*this)->executor.post_msg(event); @@ -100,6 +105,7 @@ void TopBlock::run(void) void TopBlock::wait(void) { + //(*this)->thread_group->join_all(); while (not (*this)->token.unique()) { boost::this_thread::yield(); |