Subscribing

PPS clients can subscribe to multiple objects, and PPS objects can have multiple subscribers. When a publisher changes an object, all clients subscribed to that object are informed of the change.

To subscribe to an object, a client simply calls open() for the object with O_RDONLY to subscribe only, or O_RDWR to publish and subscribe. The subscriber can then query the object with a read() call. A read returns the length of the data read, in bytes.

Note:

It's safe for more than one subscriber to read from the objects because the pps manager guarantees that each PPS read() is atomic.

Attribute order

PPS doesn't guarantee that attributes will be read in the same order that they were written to the object. That is, a publisher may write:
@Time
hour::17
minute::04
second::38
This may be read in by a subscriber as, for instance:
@Time
second::38
hour::17
minute::04

For information about routines that will help you parse attributes, see the PPS Encoding and Decoding API and PPS API reference chapters.