ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

After reading http://wiki.ros.org/roscpp/Internals and a few source files, I think I got what is going on.

The behavior depends on whether no-copy publishing (via shared_ptr messages) is used or not. In no-copy intraprocess publishing, the published message is directly put on the subscriber's callback queue. In intraprocess serialized pubsub connection (when you publish just a reference or a copy of the message), the callback queue of the subscriber is not directly updated from the publisher. It instead goes into the publisher output queue and waits for PollManager to move the callback from the publisher output queue to the subscriber callback queue.

As referenced later in the source code analysis, the PollSet gets signaled right after a serialized message is put in the publisher output queue. The signaling is done via a pipe, which can be buffered in kernel. So I think this is what brings asynchronicity in the code.

Relevant source lines: