# Block::system\_handler done message format

**URL:** <https://www.ruby-forum.com/t/block-system-handler-done-message-format/242552>\
**Category:** GNU Radio\
**Created:** [July 2, 2015, 5:12am UTC](https://www.ruby-forum.com/t/block-system-handler-done-message-format/242552 "2015-07-02T05:12:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [July 2, 2015, 5:12am UTC](https://www.ruby-forum.com/t/block-system-handler-done-message-format/242552/1 "2015-07-02T05:12:44Z")

</div>

As I was investigating the message passing subsystem I noticed that my  
own blocks had a “system” port that I did not manually register.  
Looking through the code I found in block.cc the special message to put  
the block in a finished state:

void  
block::system\_handler(pmt::pmt\_t msg)  
{  
//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());  
} else {  
std::cout \<\< “WARNING: bad message op on system port!\n”;  
pmt::print(msg);  
}  
}

Maybe I don’t understand the reason for this, but it appears that this  
code requires pmt::cdr(msg) to return a long int and then implicitly  
casts to a bool. Wouldn’t it be better for this to be a bool already  
such that a message could be constructed like

pmt::cons(pmt::mp(“done”), pmt::get\_PMT\_T())

or Python

pmt.cons(pmt.to\_pmt(“done”), pmt.PMT\_T) ?

Perhaps it really doesn’t matter. It just seems more natural,  
particularly if one were to put a logical statement as the argument to  
pmt::cons.

Jared.
