# General\_Work Not Executing

**URL:** <https://www.ruby-forum.com/t/general-work-not-executing/243173>\
**Category:** GNU Radio\
**Created:** [August 28, 2015, 7:03pm UTC](https://www.ruby-forum.com/t/general-work-not-executing/243173 "2015-08-28T19:03:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [August 28, 2015, 7:03pm UTC](https://www.ruby-forum.com/t/general-work-not-executing/243173/1 "2015-08-28T19:03:01Z")

</div>

Hello All,

I recently rewrote the Chat Sanitize and Chat Receiver blocks from the  
Tutorial module(Example 5) in C++. I did this because I wanted to add an  
acknowledgment feature into the blocks in order to add some robustness  
to  
it(I’m not sure yet if the chat example will lend itself to being robust  
but it was the starting point I chose). The problem arose when I added  
an  
input port to the Text Sanitize block and added an output to the Chat  
Receiver block and connected them together. Instead of a linear program  
I  
now had a loop of a program. I did something wrong because now the Text  
Sanitize block wasn’t outputting anything, so I commented out the input  
code for Text Sanitize and the output code for Chat Receiver. I went to  
retest the program to see if it behaved just like Example 5(which it was  
before I started adding on the acknowledgment bits) but now Text  
Sanitize  
wasn’t outputting anything still.

I tried putting some cout’s in the general \_work function where the  
message  
publishing code is and I have determined that it’s not even entering the  
general\_work function.

Does anyone have any thoughts on the matter? I must have changed  
something  
when I commented out the input portion of the Text\_Sanitize code but for  
the life of me I can’t figure out what it is. I have even since made two  
new blocks to try and redo the functionality of Text Sanitize but the  
same  
problem still persists.

My code can be found at: [https://github.com/loganwashbourne/Thesis.git](https://github.com/loganwashbourne/Thesis.git)

The juicy files are in the Thesis/OOT/gr-ACK/lib folder.

There might be some profanity in the commit messages, it was a stressful  
day.

I appreciate your time,

Logan Washbourne  
Electrical Engineering Graduate Student  
(Electromagnetics)

---

<div class="post-metadata">

**Author:** ![WashbourneS\_Logan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ec9cab/32.png) [@WashbourneS\_Logan](https://www.ruby-forum.com/u/WashbourneS_Logan)\
**Post date:** [August 31, 2015, 3:46pm UTC](https://www.ruby-forum.com/t/general-work-not-executing/243173/2 "2015-08-31T15:46:37Z")

</div>

On Fri, Aug 28, 2015 at 12:49 PM, Washbourne, Logan \<  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:

> Sanitize block wasn’t outputting anything, so I commented out the input  
> when I commented out the input portion of the Text\_Sanitize code but for  
> the life of me I can’t figure out what it is. I have even since made two  
> new blocks to try and redo the functionality of Text Sanitize but the same  
> problem still persists.

So this will be a good lesson in using git! It’s good to keep small,  
quantified changes in git so that you know where you are versus where  
you  
started when making a change. “git diff” is your friend here. Lots of  
ways  
to use this tool to help in your development cycle.

(Also, looking at your git repo, you’ve checked in the ‘~’ temp files  
from  
your editor [emacs I assume]. You don’t want any temp or auto-generated  
files in a git repository; just stuff that you’ve created that needs to  
be  
tracked.)

The problem is that this block is designed only to output messages, not  
a  
data stream. You can see in the constructor that the io\_signature is  
using  
(0, 0, 0) for both inputs and outputs. The scheduler doesn’t recognize  
this  
block in the stream and so never things to call the general\_work. The  
original blocks you are referring to only have message interfaces.

Hope this helps get you in the right direction.

Tom

---

<div class="post-metadata">

**Author:** ![WashbourneS\_Logan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ec9cab/32.png) [@WashbourneS\_Logan](https://www.ruby-forum.com/u/WashbourneS_Logan)\
**Post date:** [August 31, 2015, 7:29pm UTC](https://www.ruby-forum.com/t/general-work-not-executing/243173/3 "2015-08-31T19:29:47Z")

</div>

On Mon, Aug 31, 2015 at 11:28 AM, Washbourne, Logan \<  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:

> model it directly after the ChatApp tutorial, and I’m pretty sure that’s  
> what the send and receive blocks in that project were doing.
> 
> Is this not a good practice or infeasible?
> 
> Logan Washbourne  
> Electrical Engineering Graduate Student  
> (Electromagnetics)

Hi Logan,

Have another look at the Python code you were copying from. The  
chat\_sanitizer just creates a message output port and we call it’s  
post\_message from the main app when a user is ready to post. There’s  
nothing automatic about it, so no work function to be called. The  
chat\_receiver code just waits until a message is posted to it, at which  
point it wakes up and fires off its handle\_msg function to process the  
message.

What you’re trying to do is feasible, but I think you’ll need to  
understand  
the message passing system in the scheduler instead of the data  
streaming  
model to get a better handle on it.

Tom

---

<div class="post-metadata">

**Author:** ![WashbourneS\_Logan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ec9cab/32.png) [@WashbourneS\_Logan](https://www.ruby-forum.com/u/WashbourneS_Logan)\
**Post date:** [August 31, 2015, 5:29pm UTC](https://www.ruby-forum.com/t/general-work-not-executing/243173/4 "2015-08-31T17:29:26Z")

</div>

Tom,

Thanks for the reply!

So unfortunately I started using git after I found out that the code  
wasn’t  
entering general\_work. It was actually the reason I started using git,  
so  
this wouldn’t happen again haha. Thanks for the temp files tip, I’ll try  
to  
fix that today.

For the blocks, I think I just want them to pass messages. I’m trying to  
model it directly after the ChatApp tutorial, and I’m pretty sure that’s  
what the send and receive blocks in that project were doing.

Is this not a good practice or infeasible?

Logan Washbourne  
Electrical Engineering Graduate Student  
(Electromagnetics)

---

<div class="post-metadata">

**Author:** ![WashbourneS\_Logan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ec9cab/32.png) [@WashbourneS\_Logan](https://www.ruby-forum.com/u/WashbourneS_Logan)\
**Post date:** [September 1, 2015, 6:28pm UTC](https://www.ruby-forum.com/t/general-work-not-executing/243173/5 "2015-09-01T18:28:32Z")

</div>

Tom,

Thanks for pointing me in a new direction. I’ve spent this morning  
reading  
about the scheduler and I came across your Scheduler Details slide show  
from 2013. I saw the message passing protocol on slide 15, which makes  
sense, but I am not reaching the first bullet point, my messages are not  
being published. So then I continued reading and came across slide 29  
and I  
see that if a block is not a streaming block then BLKD\_IN gets set,  
which I  
then found the gr\_block\_executor.h file and saw the comment next to the  
BLKD\_IN state, which reads that the block is now blocked and waiting for  
input data. I must be not fully understanding that flowchart because I  
can’t see how those steps apply to a source block that doesn’t rely on  
input data.

The next step in my mind is either to figure out how to get the  
scheduler  
to recognize a block that only outputs messages or to figure out how to  
call the function within my block that publishes the message without  
relying on the scheduler.

Do you have any other sources that detail the scheduler? Or any advice  
in  
helping to understand the presentation about the scheduler?

I appreciate your time,

Logan Washbourne  
Electrical Engineering Graduate Student  
(Electromagnetics)
