OpenSplice ISO C++ 2 DCPS  v6.x
ISO C++ 2 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
Share QoS

This QosPolicy is used to share a DataReader between multiple processes.

NOTE: This is an OpenSplice-specific QosPolicy, it is not part of the DDS Specification.

Attributes

Value Meaning Concerns RxO Changeable
A string:
name
The label used to identify the shared Entity. DataReader,Subscriber N/A No
A boolean:
enable
Controls whether the entity is shared.

This QosPolicy allows sharing of entities by multiple processes or threads. When the policy is enabled, the data distribution service will try to look up an existing entity that matches the name supplied in the ShareQosPolicy. A new entity will only be created if a shared entity registered under the specified name doesn’t exist yet. Shared Readers can be useful for implementing algorithms like the worker pattern, where a single shared reader can contain samples representing different tasks that may be processed in parallel by separate processes. In this algorithm each processes consumes the task it is going to perform (i.e. it takes the sample representing that task), thus preventing other processes from consuming and therefore performing the same task.

NOTE: Entities can only be shared between processes if OpenSplice is running in federated mode, because it requires shared memory to communicate between the different processes.

By default, the ShareQosPolicy is not used and enable is FALSE. Name must be set to a valid string for the ShareQosPolicy to be valid when enable is set to TRUE.

This QosPolicy is applicable to DataReader and Subscriber entities, and cannot be modified after the DataReader or Subscriber is enabled. Note that a DataReader can only be shared if its Subscriber is also shared.