Since nothing shown calls send_msg I assume you are calling send_msg from another thread besides the one running the container? The connection is single threaded and designed to be used only by the container thread. Doing otherwise could likely present itself as you describe, and likely result in illegal multithreading, since calling send does not itself cause IO to occur, its the general container processing does (and it happens to wake itself every few seconds in absence of other activity, only doing your IO work as a side effect).
If you want to do e.g a send from another thread you need to hand off work to occur on the container thread, or use your own constructs to pick up the work. I believe the 'work_queue' is the intended route for things like this in C++: http://qpid.apache.org/releases/qpid-proton-0.35.0/proton/cpp/api/classproton_1_1work__queue.html Its used in the examples, e.g: http://qpid.apache.org/releases/qpid-proton-0.35.0/proton/cpp/api/scheduled_send_8cpp-example.html#_a3 http://qpid.apache.org/releases/qpid-proton-0.35.0/proton/cpp/api/multithreaded_client_8cpp-example.html Alternatively you can e.g wake the container and do your own coordination: http://qpid.apache.org/releases/qpid-proton-0.35.0/proton/cpp/api/classproton_1_1connection.html#a473371542eaeba6f67660582fe6a6074 Robbie On Mon, 4 Oct 2021 at 09:36, Millieret, Xavier <xaviermillie...@eaton.com> wrote: > > Hi all, > > I work on the qpid-protn 0.34 on linux Debian 11, and with mosquito broker, > with version 2.0.10-6. > I have an issue and I don't understand why, when I do this: > > Chain send message just after an on_sender_open, it's ok, and relatively fast > > class client : public proton::messaging_handler > { > > public: > > void on_connection_open(proton::connection& con) > { > con.open_receiver(myAddress); > } > > void on_sender_open(proton::sender& sender) > { > proton::message msg; > req.body("test"); > sender.send(msg); > } > } > > And if I do the following code, > i.e. > Handle the my client object to reuse the connection, and send the message > with this connection, every time when I want > > class client : public proton::messaging_handler > { > private: > proton::sender m_sender; > > void on_connection_open(proton::connection& con) > { > con.open_receiver(myAddress); > } > > void on_sender_open(proton::sender& s) > { > m_sender = s; > } > > void send_msg()(const proton::message& msg) > { > m_sender.send(msg); > } > } > > It's works, but unfortunately, with this code, it's slower than the previous > one (around 2seconds) > > Any help to understand what's happening, will be helpful. > > Regards > > Xavier Millieret > > > > ________________________________ > Eaton Industries (France) S.A.S ~ Si?ge social: 110 Rue Blaise Pascal, > Immeuble Le Vis?o - B?timent A Innovall?e, 38330, Montbonnot-St.-Martin, > France ~ Lieu d'enregistrement au registre du commerce: Grenoble ~ Num?ro > d'enregistrement: 509 653 176 ~ Capital social souscrit et liber?:EUR > 16215441 ~ Num?ro de TVA: FR47509653176 > > ________________________________ > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org For additional commands, e-mail: users-h...@qpid.apache.org