Try to directly call UI callbacks if we're already in the UI thread; call wake_ui...