On 01/04/2013 07:20 PM, Jose Torres Diaz wrote:
> Hi Community,
> 
> I'm working with blob manager to implement our design. The block diagram in
> GRExtras looks similar to this:
> 
> BLOCK 1 --> BLOCK 2 --> BLOCK 3 --> SINK
> 
> Where, Block 1 contains the manager as follows:
> 
> MsgBlobManager = pmt::pmt_mgr::make();
>       for (size_t i = 0; i < MSG_BLOBS_ALLOCATION; i++)
>           {
> 
> MsgBlobManager->set(pmt::pmt_make_blob(BLOB_MSG_INITIAL_SIZE));
>           }
> 
> 
> However, when I made some changes in the blob that is passing around in
> BLOCK 2 (only 1 field of the blob), in BLOCK 3 I received the old data from
> BLOCK 1. This happens exactly 3 times until BLOCK 3 received the correct
> updated data.
> 
> I'm not sure if it is related due to previous blocks are keeping a
> reference to the incoming message (as explained in
> https://github.com/guruofquality/grextras/wiki#wiki-pmt-manager-object).
> What I do not know either is the following:
> 
> "Normally, a PMT is created and passed to a downstream consumer. When all
> downstream consumers delete their references to the PMT, the object is
> deconstructed and freed back into nothingness"
> 
> 1. How the downstream consumer delete their reference to a PMT object?
> 2. Is it automatically done or should I explicitly do this?
> 

Its automatic, via deleting all references.

See boost intrusive_ptr
http://www.boost.org/doc/libs/1_52_0/libs/smart_ptr/intrusive_ptr.html

In the case of the manager, the manager object hold 1 reference. When
you ask the manager for an available pmt, it looks for all objects that
have a reference count of 1. ie the manager is the only reference holder.

I hope that helps some understanding.

If you are trying to trace the flow of the messages, you can also print
the pointer underlying object.
std::cout << "ptr to underlying object " << size_t(some_pmt.get())


-josh
> Thanks for your time and advice,
> 
> Regards,
> 
> Jose.
> 
> 
> 
> _______________________________________________
> Discuss-gnuradio mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> 

_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to