Interface UiRuntime.Waker

Enclosing class:
UiRuntime
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface UiRuntime.Waker
Wakes the native event loop when work is posted.

Called for every post, from the UI thread as well as from any other, and the decision about whether a wake is actually needed is the waker's rather than this class's. That is where the decision belongs, because the runtime cannot tell a caller that is re-entrant inside a native pump from an ordinary one inside a drain, and the backend can: a UI-thread post from inside a drain needs nothing, because the loop re-reads UiRuntime.nanosUntilNextDeadline() before it sleeps again, while a UI-thread post from inside a platform callback made while the loop is parked waits for unrelated input unless somebody wakes it. An accessibility callback is that second shape, and on one platform it is the only one in the process.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Wakes the loop, or does nothing when the caller cannot be waiting on it.
  • Method Details

    • wake

      void wake()
      Wakes the loop, or does nothing when the caller cannot be waiting on it.