summaryrefslogtreecommitdiff
path: root/lib/block_task.cpp
diff options
context:
space:
mode:
authorJosh Blum2012-08-30 01:05:53 -0700
committerJosh Blum2012-08-30 01:05:53 -0700
commite661028006d0f36ad10672f4d0fa034c157e882d (patch)
tree1a9449b20de7a7803f8ad38b57d9e912cb1b96a5 /lib/block_task.cpp
parent36f216977ff79a72b3c5498162659050bc7552ad (diff)
downloadsandhi-e661028006d0f36ad10672f4d0fa034c157e882d.tar.gz
sandhi-e661028006d0f36ad10672f4d0fa034c157e882d.tar.bz2
sandhi-e661028006d0f36ad10672f4d0fa034c157e882d.zip
cleanups from the previous commit
Diffstat (limited to 'lib/block_task.cpp')
-rw-r--r--lib/block_task.cpp41
1 files changed, 18 insertions, 23 deletions
diff --git a/lib/block_task.cpp b/lib/block_task.cpp
index d871f12..d9b52f0 100644
--- a/lib/block_task.cpp
+++ b/lib/block_task.cpp
@@ -20,26 +20,27 @@
using namespace gnuradio;
-void ElementImpl::free_inputs(const tsbe::TaskInterface &task_iface)
-{
- for (size_t i = 0; i < task_iface.get_num_inputs(); i++)
- {
- while (not this->input_queues[i].empty())
- {
- this->input_queues[i].pop();
- }
- this->inputs_ready.set(i, false);
- }
-}
-
void ElementImpl::mark_done(const tsbe::TaskInterface &task_iface)
{
- if (not this->active) return;
+ if (this->done) return; //can re-enter checking done first
+
+ //mark down the new state
this->active = false;
+ this->done = true;
+
+ //release upstream, downstream, and executor tokens
this->token_pool.clear();
- this->token.reset();
- this->free_inputs(task_iface);
+
+ //release allocator tokens, buffers can now call deleters
this->output_buffer_tokens.clear();
+
+ //release all buffers in queues
+ this->input_queues.clear();
+ this->output_queues.clear();
+
+ //tell the upstream and downstram to re-check their tokens
+ //this is how the other blocks know who is interested,
+ //and can decide based on interest to set done or not
for (size_t i = 0; i < task_iface.get_num_inputs(); i++)
{
task_iface.post_upstream(i, CheckTokensMessage());
@@ -48,18 +49,12 @@ void ElementImpl::mark_done(const tsbe::TaskInterface &task_iface)
{
task_iface.post_downstream(i, CheckTokensMessage());
}
- HERE();
- VAR(name);
+
+ std::cout << "This one: " << name << " is done..." << std::endl;
}
void ElementImpl::handle_task(const tsbe::TaskInterface &task_iface)
{
- //FIXME in case we get called in the inactive state, assuming done?
- if (not this->active)
- {
- this->free_inputs(task_iface);
- }
-
//------------------------------------------------------------------
//-- Decide if its possible to continue any processing:
//-- Handle task may get called for incoming buffers,