15.6.2. Non-blocking calls

Note

As OSX does not support necessary POSIX Real-time features, this feature is not fully supported on OSX. In that case, the feature is limited by the implementation of std::timed_mutex and std::condition_variable_any.

Several functions on the Fast DDS API can be blocked for an undefined period of time when operations compete for the control of a resource. The blocked function cannot continue until the operation that gained the control finishes, thus blocking the calling thread.

Real-time applications need a predictable behavior, including a predictable maximum time since a function is called until it returns control. In order to comply with this restriction, Fast DDS can be configured to limit the maximum blocking time of these functions. If the blocking time limit is exceeded, the requested operation is aborted and function terminated, returning the control to the caller.

This configuration needs two steps:

  • Set the CMake option -DSTRICT_REALTIME=ON during the compilation of the application.

  • Configure the maximum blocking times for the functions.

Fast RTPS non-blocking API

Method

Configuration attribute

Default value

DataWriter::write()

reliability().max_blocking_time on DataWriterQos.

100 milliseconds.

DataReader::take_next_sample()

reliability().max_blocking_time on DataReaderQos.

100 milliseconds.

DataReader::read_next_sample()

reliability().max_blocking_time on DataReaderQos.

100 milliseconds.

DataReader::wait_for_unread_message()

The method accepts an argument with the maximum blocking time.