Help needed running concurrent tasks


What is the correct way to run asynchronous tasks, to for example:

  1. Run an infinite loop that receives, processes data and finally stores the data into a variable.
  2. Use app normally and have an Observable.interval that gets that data every X seconds and updates the view with it.

I already developed it but it seems like when a process is running the other stops, for example, when the interval task is already running, calling the infinite loop (which is handled with callbacks) will make the observable to be interrupted.