Hi all, I am working on a custom block that tags a stream based on a binary file stretched into unpacked form: (1) (2) (3) gr_file_source(repeat=false) --> gr_packed_to_unpacked(1, gr.MSB_FIRST) --> my_block I want to come up with a good way to detect in my_block whether the stream input from (2) is finished. I guess gr_file_source will return WORK_DONE first, but I don't know if/how that ripples down to my_block. Basically I want to be able to tag the last incoming sample with an end-of-burst tag, but I don't know how to do this without having advance knowledge about the size of the source file. Thanks, Sean
on 2012-11-13 22:33
on 2012-11-14 04:43
On Tue, Nov 13, 2012 at 4:32 PM, Nowlan, Sean <Sean.Nowlan@gtri.gatech.edu> wrote: > (3) > but I dont know how to do this without having advance knowledge about the > size of the source file. > > > > Thanks, > > Sean Sean, Yeah, you won't be able to tell if you're at the end of the file or if the scheduler just passed you 0 items to process. There's no indication of that. Probably the easiest thing for you to do is quickly edit the file source block to generate the tag when it reaches EOF. That should be pretty straight-forward. Tom
on 2012-11-14 16:16
Good point. That's probably what I'll do. Is there any way to check whether upstream blocks are done? From examining gr_block_executor, it knows how to do this, so would it make sense to have it alert downstream blocks?
on 2012-11-21 17:33
On Wed, Nov 14, 2012 at 9:35 AM, Nowlan, Sean <Sean.Nowlan@gtri.gatech.edu> wrote: > Good point. That's probably what I'll do. > > Is there any way to check whether upstream blocks are done? From examining gr_block_executor, it knows how to do this, so would it make sense to have it alert downstream blocks? I was thinking about this and then forgot to reply. The answer is, I'm pretty sure, no (at least, not without added overhead). You'd break some of the independence of blocks if you tried to organize something like. What the scheduler does is look to see if anyone has returned -1, which will happen if a source is finished (like after reading a file) or from someone like a gr_head block. This propagates down to the scheduler who uses this info to start cleaning up, which means pushing through any more existing items through the blocks and to the sinks. You couldn't really put something into another block because there still might be items coming to it from upstream even if the source(s) is(are) finished. Tom
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.