Async/await in C++

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

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

You tried using this:

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

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#

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.

Here’s the API documentation, though:

https://docs.unrealengine.com/latest/INT/API/Runtime/Core/Async/index.html

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.

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?