Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'system_handler' into next
Conflicts:
	volk
  • Loading branch information
bastibl committed Jun 4, 2015
2 parents ec714f9 + 4796270 commit 5930587
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 37 deletions.
10 changes: 0 additions & 10 deletions gnuradio-runtime/include/gnuradio/block.h
Expand Up @@ -631,11 +631,6 @@ namespace gr {
*/
void system_handler(pmt::pmt_t msg);

/*!
* \brief returns true when execution has completed due to a message connection
*/
bool finished();

private:
int d_output_multiple;
bool d_output_multiple_set;
Expand All @@ -654,7 +649,6 @@ namespace gr {
int d_priority; // thread priority level
bool d_pc_rpc_set;
bool d_update_rate; // should sched update rel rate?
bool d_finished; // true if msg ports think we are finished

protected:
block(void) {} // allows pure virtual interface sub-classes
Expand Down Expand Up @@ -841,10 +835,6 @@ namespace gr {
*/
void notify_msg_neighbors();

/*! \brief Make sure we dont think we are finished
*/
void clear_finished(){ d_finished = false; }

};

typedef std::vector<block_sptr> block_vector_t;
Expand Down
14 changes: 2 additions & 12 deletions gnuradio-runtime/lib/block.cc
Expand Up @@ -707,8 +707,8 @@ namespace gr {
//std::cout << "system_handler " << msg << "\n";
pmt::pmt_t op = pmt::car(msg);
if(pmt::eqv(op, pmt::mp("done"))){
d_finished = pmt::to_long(pmt::cdr(msg));
global_block_registry.notify_blk(alias());
notify_msg_neighbors();
detail().get()->set_done(true);
} else {
std::cout << "WARNING: bad message op on system port!\n";
pmt::print(msg);
Expand Down Expand Up @@ -747,16 +747,6 @@ namespace gr {
}
}

bool
block::finished()
{
if((detail()->ninputs() != 0) || (detail()->noutputs() != 0))
return false;
else
return d_finished;
}



void
block::setup_pc_rpc()
Expand Down
18 changes: 3 additions & 15 deletions gnuradio-runtime/lib/tpb_thread_body.cc
Expand Up @@ -89,11 +89,7 @@ namespace gr {
gr::thread::set_thread_priority(d->thread, block->thread_priority());
}

// make sure our block isnt finished
block->clear_finished();

while(1) {
tpb_loop_top:
boost::this_thread::interruption_point();

// handle any queued up messages
Expand Down Expand Up @@ -125,10 +121,6 @@ namespace gr {
s = block_executor::BLKD_IN;
}

// if msg ports think we are done, we are done
if(block->finished())
s = block_executor::DONE;

switch(s){
case block_executor::READY: // Tell neighbors we made progress.
d->d_tpb.notify_neighbors(d);
Expand All @@ -139,7 +131,6 @@ namespace gr {
break;

case block_executor::DONE: // Game over.
block->notify_msg_neighbors();
d->d_tpb.notify_neighbors(d);
return;

Expand All @@ -149,12 +140,9 @@ namespace gr {
while(!d->d_tpb.input_changed) {

// wait for input or message
while(!d->d_tpb.input_changed && block->empty_handled_p()){
boost::system_time const timeout=boost::get_system_time()+ boost::posix_time::milliseconds(250);
if(!d->d_tpb.input_cond.timed_wait(guard, timeout)){
goto tpb_loop_top; // timeout occured (perform sanity checks up top)
}
}
while(!d->d_tpb.input_changed && block->empty_handled_p()) {
d->d_tpb.input_cond.wait(guard);
}

// handle all pending messages
BOOST_FOREACH(basic_block::msg_queue_map_t::value_type &i, block->msg_queue) {
Expand Down

0 comments on commit 5930587

Please sign in to comment.