Загрузка...

UEC++ From Basics to Advanced | M17-005: FThreadSafeBool

This video introduces FThreadSafeBool, a lock-free atomic boolean type built on FThreadSafeCounter. It provides thread-safe read and write operations without requiring a full critical section, making it ideal for flags that control thread execution flow, such as the bRunning flag in a FRunnable Run loop.

The video explores the source code to show how FThreadSafeBool internally uses atomic operations. Though the engine has marked it with a deprecation hint suggesting std::atomic, it remains widely used within the engine itself and is perfectly functional.

We demonstrate converting a FRunnable to use FThreadSafeBool for the Stop signal instead of a plain volatile bool, showing that the atomic guarantees prevent subtle reads of stale values across threads. The lock-free nature means no contention with other threads using locks.

Видео UEC++ From Basics to Advanced | M17-005: FThreadSafeBool канала Huagang Liu
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять