Tim,

Sorry, this should have been:

    hpx::apply_cb<server::Block::receiveImage_action>(
        recipient,
        [this](boost::system::error_code const&, hpx::parcelset::parcel
const&) mutable 
            { delete this; },
        this->image);

I.e. the callback needs to conform to this prototype:

    void callback(
        boost::system::error_code const&, 
        hpx::parcelset::parcel const&);

HTH
Regards Hartmut
---------------
http://boost-spirit.com
http://stellar.cct.lsu.edu


> -----Original Message-----
> From: Hartmut Kaiser [mailto:hartmut.kai...@gmail.com]
> Sent: Friday, December 9, 2016 9:09 AM
> To: 'hpx-users@stellar.cct.lsu.edu' <hpx-users@stellar.cct.lsu.edu>
> Subject: RE: [hpx-users] archive data bstream data chunk size mismatch:
> HPX(serialization_error)
> 
> Tim,
> 
> > could the following two lines cause the issue?
> >
> > hpx::apply<server::Block::receiveImage_action>(recipient, this->image);
> >      delete this;
> >
> > Basically, we're invoking a fire and forget action with a member
> > variable (which will be serialized) as parameter. Afterwards, the
> > instance is directly deleted.   I guess the serialization/parameter
> > transmission of the action does not happen right away and we're deleting
> > the send buffer too early.
> >
> > How can we know - without using async() and waiting for the future -
> > that the "fire part" of fire and forget has been completed and we can
> > delete the send buffer?
> 
> You might want to do this instead:
> 
>     hpx::apply_cb<server::Block::receiveImage_action>(
>         recipient,
>         [this]() mutable { delete this; }
>         this->image);
> 
> instead.
> 
> hpx::apply_cb calls the supplied function whenever it's safe to release
> the data.
> 
> Regards Hartmut
> ---------------
> http://boost-spirit.com
> http://stellar.cct.lsu.edu
> 


_______________________________________________
hpx-users mailing list
hpx-users@stellar.cct.lsu.edu
https://mail.cct.lsu.edu/mailman/listinfo/hpx-users

Reply via email to