set data into UBlueprintAsyncActionBase asynchronous blueprint node.
get data in the Tick event on the actor blueprint node.
Most Unreal containers do not have their own synchronization. Instead, they rely on your code to be properly interlocked – meaning, you’ll need a mutex.
The reason is that you often need to synchronize more than one thing, so a fine-grained lock on the container itself is wasteful. And frequently, you’ll only be running in one thread, and a lock would just be unnecessary overhead there.
TQueue’s are special in UE4 and play pretty well in a multithreaded environment. By default they are spsc (single producer single consumer) and you have to specify mpsc if you’re adding to the queue from multiple threads.
jwatte is correct that ‘most’ Unreal containers are not threadsafe, and to my knowledge TQueue is the only one that is.
Cheers
John
2 Likes