Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

250
Vistas
Kotlin runBlocking on background thread

I'm in the process of converting an existing app from Java to Kotlin. The app creates an IntentService which runs in a background thread and is tasked to perform some operations which block the thread (e.g. network calls, database interactions) with suspend functions repeatedly and indefinitely. Since the "current thread" is in fact a background thread I'm not blocking the UI.

Is it a good practice to make use of runBlocking on the current thread to run all the suspending functions? Or there is a better approach?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

That is exactly the usage of runBlocking. runBlocking was added to coroutines to create a bridge between the users of coroutines and other places that are executing the code blockingly. If you want a thread to be blocked and wait for the execution of a a coroutine, you should always use runBlocking.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda