rosin-project / rxros

Reactive programming for ROS
BSD 3-Clause "New" or "Revised" License
48 stars 6 forks source link

Using RxCpp operator subscribe_on creates an unexpected number of threads #18

Open henrik7264 opened 5 years ago

henrik7264 commented 5 years ago

The RxCpp operator subscribe_on is used in several of the RxROS functions/observables to run in dedicated threads. However, the subscribe_on operation spawns an unexpected number of threads. For a simple program that created an observable from a topic, performed a map operation and published it to a new topic at least 10 threads were spawned. The expected number was one.

Preliminary investigations have shown that

  1. The problem is general and not only associated with RxROS.
  2. The problem does not depend on the size of the program or the number of used operations.

It looks like the subscribe_on creates a pool of threads - maybe for future use.

The problem should be further investigated and maybe forwarded to the RxCpp team.