prof18/RSS-Parser

Allow parse on current thread

Closed this issue · 1 comments

I'm creating a parser and want to parse a raw string on a current, background thread on Android. Why am I forced to use some scope.launch{}, which in this situation is simply a waste - create another thread, launch it, etc., while I want to do all the parsing on the current thread. My app is aware of background processing at this time and is already showing to the user some progress indicator only.

Is this possible with the current release of RSS-Parser library? If so, how?

On the Kotlin side, the library follows the same principles as many networking and database libraries: it handles automatically internally the switch from the main thread. For that, it uses Kotlin coroutines and Coroutines doesn't start a new thread from scratch. So you don't have to worry about unnecessary computation if you start the parsing with coroutines.

The Java side is using an ExecutorService, so it starts a thread. However, the Java side is not maintained anymore.