12

I'm trying to figure out which Dispatcher to use in what case.

I read some documentation and came up with this:

  • Default → CPU work
  • Main → main (update UI)
  • Unconfined
  • IO → writing file / network tasks

Is this right?

What about Unconfined?

solaza
  • 1,251
  • 1
  • 17
  • 30

1 Answers1

6

You're right in your assumptions about the dispatcher types. Unconfined dispatcher –

A coroutine dispatcher that is not confined to any specific thread

Unconfined dispatcher is appropriate when coroutine does not consume CPU time nor updates any shared data (like UI) that is confined to a specific thread.

You can read more about it here and here

Community
  • 1
  • 1
Andrei Tanana
  • 7,932
  • 1
  • 27
  • 36