# What is the best way to await the joining of a system.util.invokeAsyncronous() call?

**URL:** <https://forum.inductiveautomation.com/t/what-is-the-best-way-to-await-the-joining-of-a-system-util-invokeasyncronous-call/84231>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [January 13, 2024, 2:15am UTC](https://forum.inductiveautomation.com/t/what-is-the-best-way-to-await-the-joining-of-a-system-util-invokeasyncronous-call/84231 "2024-01-13T02:15:40Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 17, 2024, 12:58am UTC](https://forum.inductiveautomation.com/t/what-is-the-best-way-to-await-the-joining-of-a-system-util-invokeasyncronous-call/84231/15 "2024-01-17T00:58:43Z")

</div>

If you look at my `later.py`, you will find that my wrappers for the various `invoke` operations return `CompleteableFuture` instances, with which you can do `.whenComplete(doSomethingElse)`.

At the moment, you have to subclass `BiConsumer` to use that, but when IA picks up jython 2.7.4, it will include my fix for the auto wrapping of callables for that purpose. (:

Hint here:

> [@Update GUI via Asynchronous thread](https://forum.inductiveautomation.com/t/update-gui-via-asynchronous-thread/9666/11):
>
> OK. I’ve poked myself with the futures idea. Grab the latest version of [later.py](https://www.automation-pros.com/ignition/later.py), then try this: def asyncInvoked(): # do something in the background shared.later.callLater(system.gui.messageBox, "Please Press OK").get() # do something after OK is pressed system.util.invokeAsynchronous(asyncInvoked) Note the use of .get() to wait for system.gui.messageBox to complete. This updated later.py includes an emulation of invokeLater for gateway scope. Untested and unsupported! Edit: Realized…

---

_[View the full topic](https://forum.inductiveautomation.com/t/what-is-the-best-way-to-await-the-joining-of-a-system-util-invokeasyncronous-call/84231)._
