title: Kotlin Coroutines wait until done init block
body: <p>I'm currently learning coroutines and need your help :)</p>
  
  <p>How I can force to wait until <em>retrofit</em> has initialized? </p>
  
  <pre><code>private lateinit var retrofit: Retrofit
  
  init {
      val time = measureTimeMillis {
          launch {
              val httpClient = createOkHttpClient(...)
              val gson = createGson()
              retrofit = createRetrofit(httpClient.await(), gson.await())}
      }
      logger.debug("Init time: $time")
  }
  
   private fun &lt;T&gt; createService(class: Class&lt;T&gt;) = retrofit.create(_class)
  </code></pre>
  
  <p>With runBlocking it works, but I really not wanted to use this...</p>
  
  <p>Thanks in advance! </p>