I would do it this way:
- Make a "global" (seen for UI thread and background thread) object of one of concurrent types. You can make it as singleton or pass an object to both threads
- All the long running thread does is reading data from concurrent object and process them.
- If main thread (or any other) need to do anything in background simply adds it to the concurrent collection.
This kind of approach in concurrent programming is called Producer-consumer problem