- class unreal.NeuralThreadMode¶
After an asynchronous operation has finished, whether the callback functions tied to the delegate will be called from the game/main thread (highly recommended) or from any thread (not fully Unreal safe). This enum class is only useful for the case of ENeuralSynchronousMode::Asynchronous.
Not recommended, use at your own risk (potentially more efficient than GameThread but not UE-safe in all cases). The callback functions tied to the delegate will be called from the same thread at which the operation was asynchronously computed, thus this could happen from any thread.
Main issue: U-classes (e.g., UNeuralNetwork) should not be used from non-game threads because it is not safe and could lead to issues/crashes if not properly handled by the user. E.g., the GC does not work from non-game threads so it might crash if the editor/UE is closed while accessing UNeuralNetwork information from the callback function.
Thus “AnyThread” is only safe if you have guarantees that your case is fully U-class safe. E.g., the program will not be terminated while calling the callback function.
Highly recommended and default value. The callback functions tied to the delegate will be called from the game/main thread.