You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Fixed a potential crash if the procedural sound wave object used by voice chat was unexpectedly garbage collected.
8
+
- Fixed an issue where clients would not connect to voice chat channels correctly if there were multiple voice chat components referencing the same voice chat group.
9
+
- Fixed an issue where clients would not reconnect to voice chat channels when the server performs server travel, or the client otherwise disconnects and then quickly reconnects to the same game server.
10
+
- Fixed an issue where presence was not working correctly on Meta Quest.
11
+
- Fixed a crash that could happen when signing in with Google on some Android devices.
12
+
- Fixed a crash that could happen when the matchmaking engine shuts down on game exit.
13
+
- Fixed an issue where `MaxPacketHandlerBits` was not set correctly on the net connection.
14
+
- Added a new low-level `IMetaPlatformSystem` C++ API for performing custom calls to the Oculus platform SDK.
15
+
- Unreal Engine 5.3 has been removed from the build matrix, as we no longer have any Premium support customers who require support for this engine.
This release improves the asynchronous task library and fixes several issues:
6
+
7
+
- Added thread policies to asynchronous tasks, which makes writing cross-thread code easier.
8
+
- Fixed an issue where exceptions thrown by asynchronous functions using `TTask<>` were not re-thrown. This improves diagnostics when debugging crashes in Visual Studio that involve asynchronous functions.
9
+
- Fixed a crash when the engine runs `OnRegister` twice for the same voice chat component.
10
+
- Fixed a crash that could happen if voice chat was polling hardware devices for audio during game exit.
11
+
- Fixed a build error that could occur when extracting SDK files for Android builds.
12
+
- Improved the performance of the asynchronous task library and reduced the number of allocations that occur when invoking an asynchronous function.
13
+
- Increased the size of audio buffers in voice chat to reduce the chance of buffer underruns.
14
+
- Improved logging when audio buffers underrun for voice chat.
15
+
- Changed the implementation of `URedpointVoiceChatSoundWave` used by the voice chat system in an attempt to mitigate a crash caused by the audio processing logic in `USoundWaveProcedural`.
16
+
- Removed legacy code guards referring to engine versions prior to Unreal Engine 5.5.
Copy file name to clipboardExpand all lines: docs/systems/async.md
+37Lines changed: 37 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -192,3 +192,40 @@ When using `ETaskBinding::Unbound`, the first argument must always be the `IUnbo
192
192
:::info
193
193
You can also use `co_await` in non-capturing lambdas using `ETaskBinding::Lambda`, but we no longer recommend this task binding type because you can't capture locals and you need to perform any lifetime/validity checks manually.
194
194
:::
195
+
196
+
### Running asynchronous code on background threads
197
+
198
+
You can specify what thread an asynchronous function should run on with a thread task policy as the third parameter to `TTask<>`, like so:
UE_LOG(LogTemp, Warning, TEXT("This is running on a background thread."));
205
+
206
+
// co_return - always required, even in TTask<void> functions.
207
+
co_return;
208
+
}
209
+
```
210
+
211
+
Whenever you `co_await` or use `AsCallback` to invoke `MyFunction`, the entire function runs on a background thread per `FBackgroundThreadTaskPolicy`. You do not need to manually schedule the work on a different thread, and the asynchronous task library ensures that the caller of `MyFunction` resumes on it's original thread when `MyFunction` completes.
212
+
213
+
All types of asynchronous functions, including lambdas bound with `Bind()`, support thread task policies.
214
+
215
+
The available thread task policies are:
216
+
217
+
-`FCurrentThreadTaskPolicy`: This is the default when you don't specify a thread task policy, and results in the function running on the same thread as the caller.
218
+
-`FGameThreadTaskPolicy`: This function will run on the game thread. If the caller is already running on the game thread, then the function is invoked directly. If the caller is not the game thread, this function will be scheduled to run on the game thread through an internal call to `AsyncTask(ENamedThreads::GameThread, ...)`.
219
+
-`FBackgroundThreadTaskPolicy`: This function will run on a worker pool thread. If the caller is already running on a worker pool thread, then this function is invoked directly. If the caller is not a worker pool thread (e.g. it's the game thread), this function will be scheduled to run on the worker pool through an internal call to `AsyncPool(*GThreadPool, ...)`
220
+
221
+
:::danger
222
+
If the caller of an asynchronous function is running on a thread other than the game thread or worker pool, and that asynchronous function uses a thread task policy other than `FCurrentThreadTaskPolicy`, you will get an assertion when the function completes and tries to resume the caller on it's original thread.
223
+
224
+
This is because `FCurrentThreadTaskPolicy` does not know how to resume work on threads other than the game thread or worker pool (see the `FCurrentThreadTaskPolicy::RunOnDesiredThread` implementation). If you require support for other types of threads, please let support know and we will update `FCurrentThreadTaskPolicy::RunOnDesiredThread` to support your use case.
225
+
:::
226
+
227
+
:::danger
228
+
Deferred tasks created with `TTask<>::Deferred()` do not currently automatically return to the caller's thread upon `SetValue` being called. This makes certain functions such as `Delay` unsafe to call from a background thread.
229
+
230
+
We plan on changing this in the future, so that deferred tasks automatically resume execution on the thread that `TTask<>::Deferred()` ran on.
0 commit comments