Skip to content

Commit

Permalink
Add Reception threads configuration example (#754)
Browse files Browse the repository at this point in the history
* Refs #20862: Add Reception threads configuration example

Signed-off-by: Mario Dominguez <[email protected]>

* Refs #20862: Spelling

Signed-off-by: Mario Dominguez <[email protected]>

---------

Signed-off-by: Mario Dominguez <[email protected]>
  • Loading branch information
Mario-DL authored May 7, 2024
1 parent 88e13e8 commit 9c2519c
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
14 changes: 14 additions & 0 deletions code/DDSCodeTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4147,6 +4147,20 @@ void dds_qos_examples()
thread_settings.priority = 10;
thread_settings.affinity = 4;
thread_settings.stack_size = 2000;

//!--

//DDS_RECEPTION_THREADS_SETTINGS
PortBasedTransportDescriptor::ReceptionThreadsConfigMap reception_threads_config;
reception_threads_config[20000].scheduling_policy = 1;
reception_threads_config[20000].priority = 30;
reception_threads_config[20000].affinity = 2;
reception_threads_config[20000].stack_size = 1024;
reception_threads_config[20001].scheduling_policy = 2;
reception_threads_config[20001].priority = 10;
reception_threads_config[20001].affinity = 6;
reception_threads_config[20001].stack_size = 4096;

//!--
}

Expand Down
23 changes: 23 additions & 0 deletions code/XMLTester.xml
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,29 @@
<-->
<!--><-->

<!-->CONF-COMMON-RECEPTION-THREADS-SETTINGS<-->
<transport_descriptors>
<transport_descriptor>
<transport_id>Test</transport_id>
<type>UDPv4</type>
<reception_threads>
<reception_thread port="20000">
<scheduling_policy>1</scheduling_policy>
<priority>30</priority>
<affinity>2</affinity>
<stack_size>1024</stack_size>
</reception_thread>
<reception_thread port="20001">
<scheduling_policy>2</scheduling_policy>
<priority>10</priority>
<affinity>6</affinity>
<stack_size>4096</stack_size>
</reception_thread>
</reception_threads>
</transport_descriptor>
</transport_descriptors>
<!--><-->

<!-->CONF-COMMON-TRANSPORT-SETTING<-->
<transport_descriptors>
<transport_descriptor>
Expand Down
24 changes: 24 additions & 0 deletions docs/fastdds/dds_layer/core/policy/eprosimaExtensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -929,9 +929,14 @@ Changing these values may require special permissions.
* |ThreadSettings::stack_size-api|: Configures the thread's stack size in bytes.
This value is platform specific and it is used as-is to configure the specific platform thread.

The :ref:`threadsettingsqos` for reception threads in port-based transport descriptors can also be configured
by associating each thread-specific configuration with its corresponding port number.

Example
"""""""

The following example illustrate a thread settings configuration:

.. tabs::

.. tab:: C++
Expand All @@ -950,6 +955,25 @@ Example
:lines: 10,12-15,17
:dedent: 16

The subsequent example depicts a reception threads settings configuration:

.. tabs::

.. tab:: C++

.. literalinclude:: ../../../../../code/DDSCodeTester.cpp
:language: c++
:dedent: 8
:start-after: //DDS_RECEPTION_THREADS_SETTINGS
:end-before: //!

.. tab:: XML

.. literalinclude:: /../code/XMLTester.xml
:language: xml
:start-after: <!-->CONF-COMMON-RECEPTION-THREADS-SETTINGS<-->
:end-before: <!--><-->

.. _transportconfigqos:

TransportConfigQos
Expand Down

0 comments on commit 9c2519c

Please sign in to comment.