Using Slate to observe an Array updated from another thread

Hi All,

I have an SListView which observes an array Data and a function running on another thread which receives item creation / deletion requests asynchronously. On receipt, I want to update Data and call RequestListRefresh on the UI component ( doing something like this [Tutorial] Slate SListView Example )

I had a couple of ideas on how to avoid synchronization issues e.g. Data being updated again in another thread after RequestListRefresh is called and being in an invalid state when the view attempts to read it:

  • Run the update / request function as a task on the game thread using AsyncTask
  • Add a mutex to the list UI component. Acquire the mutex in the component Tick and also when modifying Data

I haven’t used Slate before so I may be missing something obvious. Thanks for any help!

For anyone who comes across this post, I ended up using an AsyncTask to run the list update + RequestListRefresh call on the Game thread to ensure thread safety. I think in the case of a lot of in built in components this is guaranteed by the way the component is run by the engine.