title: StateFlowImpl collect has a while loop,If I use it on UI Thread,Why it doesn't block UI Thread
body: <p>If I use while loop on launch,it will keep running,the click event will not execute,eventually lead to ANR.
  StateFlowImpl collect has a while loop,When will it exit the loop,this is my case:</p>
  <pre><code>class MainActivity : AppCompatActivity(), CoroutineScope by MainScope() {
      private val TAG = &quot;MainActivity&quot;
      val flow = MutableStateFlow(0)
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          launch {
              while (true) {
                  Log.d(TAG, &quot;while&quot;)
              }
          }
          launch {
              flow.collect {
                  Log.d(TAG, &quot;onCreate: $it&quot;)
              }
          }
      }
  }
  
  // This is StateFlowImpl 
  override suspend fun collect(collector: FlowCollector&lt;T&gt;) {
      val slot = allocateSlot()
      try {
          if (collector is SubscribedFlowCollector) collector.onSubscription()
          val collectorJob = currentCoroutineContext()[Job]
          var oldState: Any? = null // previously emitted T!! | NULL (null -- nothing emitted yet)
          while (true) {
              val newState = _state.value
              collectorJob?.ensureActive()
              if (oldState == null || oldState != newState) {
                  collector.emit(NULL.unbox(newState))
                  oldState = newState
              }
              if (!slot.takePending()) {
                  slot.awaitPending()
              }
          }
      } finally {
          freeSlot(slot)
      }
  }
  </code></pre>