I like the use of the watcher thread in pkt.demod_pkts, and was
wondering if I could use a similar technique in the following
situation:
Two disconnected subgraphs:
msg_source_1 -> transform_blk_1 -> msg_sink_1
msg_source_2 -> modulator
The user places ‘m’-byte messages in msg_source_1.
transform_blk consumes ‘m’ bytes and produces ‘n’ different bytes.
A queue watcher thread takes the ‘n’-byte messages from msg_sink_1,
applies a second transform, and places the result in msg_source_2.
I want to use this for encoding packets with FEC (transform_blk_1 is a
viterbi_encoder, and the queue watcher thread calls
packet_utils.make_packet(msg) when msg = self.msg_queue.delete_head()
unblocks).
Does this seem reasonable?
Is it guaranteed that x messages into msg_source_1 produces x messages
into msg_source_2? (In other words, is there any danger of messages
being combined?)
Also, if transform_blk_1 has some saved state that I’d like to reset
in between packets, is it possible/safe to do so from the Queue
watcher thread? I’m worried about race conditions…
-Steven