Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

248
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!