# Async/await in C++

**URL:** <https://forums.unrealengine.com/t/async-await-in-c/367906>\
**Category:** Feedback & Requests\
**Tags:** compiling, async, unreal-engine, FeatureRequest, CPP, question\
**Created:** [August 22, 2016, 1:48pm UTC](https://forums.unrealengine.com/t/async-await-in-c/367906 "2016-08-22T13:48:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![broly](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@broly](https://forums.unrealengine.com/u/broly)\
**Post date:** [August 22, 2016, 1:48pm UTC](https://forums.unrealengine.com/t/async-await-in-c/367906/1 "2016-08-22T13:48:59Z")

</div>

Can I use `async/await` keywords ( `/await` compilation parameter)?

I want just write async code for UE4. Is that possible?

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [August 22, 2016, 2:01pm UTC](https://forums.unrealengine.com/t/async-await-in-c/367906/2 "2016-08-22T14:01:06Z")

</div>

You tried using this:

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — https://unrealcommunity.wiki/! You will be able to find content from...

---

<div class="post-metadata">

**Author:** ![broly](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@broly](https://forums.unrealengine.com/u/broly)\
**Post date:** [August 23, 2016, 5:55am UTC](https://forums.unrealengine.com/t/async-await-in-c/367906/3 "2016-08-23T05:55:53Z")

</div>

No-no. I’m not about threads, I mean the async programming (coroutines, futures and promises):

> **[Async-Await in C++](https://paoloseverini.wordpress.com/2014/04/22/async-await-in-c/)**
>
> In the previous post we had a quick look at the problem of writing concurrent, asynchronous code with C++. We saw that the library, introduced with C++11, offers a partial solution t…

Code like this:

```
  result = await Obj->AsyncMethod(param_1, param_2); // awaiting long operation, such as RPC, but not blocking this context, and switch to another operation instead 

```

Potentially this is possible in C++ with special copilation parameter, but I don’t know how this will be conflicts with current UE4 system and other compilers…

Also this is great feature of Python and C#

---

<div class="post-metadata">

**Author:** ![ScottMichaud](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ScottMichaud](https://forums.unrealengine.com/u/ScottMichaud)\
**Post date:** [August 23, 2016, 8:46am UTC](https://forums.unrealengine.com/t/async-await-in-c/367906/4 "2016-08-23T08:46:31Z")

</div>

Unreal Engine 4 has its own Async framework. Unfortunately, the forums are down, so you can’t see an explanation that was done by Epic until it goes back up.

> **[New Core Feature: Async Framework (Master Branch and 4.8)](https://forums.unrealengine.com/showthread.php?56398-New-Core-Feature-Async-Framework-%28Master-Branch-and-4-8%29)**
>
> Hi all, We started working on a new framework for asynchronous programming, which is located in the Core module. The goal is to simplify the process of writing code that executes asynchronously or in parallel. The Engine already had several...

Here’s the API documentation, though:

[https://docs.unrealengine.com/latest/INT/API/Runtime/Core/Async/index.html](https://docs.unrealengine.com/latest/INT/API/Runtime/Core/Async/index.html)

---

<div class="post-metadata">

**Author:** ![broly](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@broly](https://forums.unrealengine.com/u/broly)\
**Post date:** [August 23, 2016, 4:46pm UTC](https://forums.unrealengine.com/t/async-await-in-c/367906/5 "2016-08-23T16:46:08Z")

</div>

Thank you for answer, ScottMichaud.

This API very similar looks like std:async. Just own rewritten part std, isn’t it?

Or this is preparation to release of `await` keyword in C++ standart?  
Reserved keywords `await`, ` __await`, `yield`, `__ yield_value`, `resumable` will be compatible with it in future?

In fact, compiler can be runned with `/await` parameter for using some this keywords in experimental mode. Maybe it could be used as a syntax sugar in UE4 soon?

---

<div class="post-metadata">

**Author:** ![ScottMichaud](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ScottMichaud](https://forums.unrealengine.com/u/ScottMichaud)\
**Post date:** [August 23, 2016, 4:50pm UTC](https://forums.unrealengine.com/t/async-await-in-c/367906/6 "2016-08-23T16:50:00Z")

</div>

Haven’t used it, but it wouldn’t surprise me. They probably just re-implemented it to make sure that it was supported on as many platforms as possible.
