# FFunctionGraphTask and TArray

**URL:** <https://forums.unrealengine.com/t/ffunctiongraphtask-and-tarray/421103>\
**Category:** C++\
**Tags:** threading, unreal-engine, question, CPP\
**Created:** [March 28, 2018, 1:08pm UTC](https://forums.unrealengine.com/t/ffunctiongraphtask-and-tarray/421103 "2018-03-28T13:08:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![HOUmmel](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/hoummel/32/1055696_2.png) [@HOUmmel](https://forums.unrealengine.com/u/HOUmmel)\
**Post date:** [March 28, 2018, 1:08pm UTC](https://forums.unrealengine.com/t/ffunctiongraphtask-and-tarray/421103/1 "2018-03-28T13:08:38Z")

</div>

I tried to use a ThreadPool to do some noise calculations. It didn’t do what i wanted to do. And since there is few info about ThreadPool i switched to FFunctionGraphTask.

Now the Problem is i need to fill an TArray with Data. But i read that its not ThreadSafe…

```
ChunkInitTasks.Add(FFunctionGraphTask::CreateAndDispatchWhenReady([&, data, CurrentPosition]()

```

data is the TArray, CurrenPosition is not used at the Moment. Is there a way to fill the Array with data, that i can use after the Tasks finished in GameThread? At the Moment the Editor Crashes when i fill the Array ☹

FChunkData containes a TArray which holds the Data of each Element in the Chunk

---

<div class="post-metadata">

**Author:** ![HOUmmel](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/hoummel/32/1055696_2.png) [@HOUmmel](https://forums.unrealengine.com/u/HOUmmel)\
**Post date:** [March 29, 2018, 11:41am UTC](https://forums.unrealengine.com/t/ffunctiongraphtask-and-tarray/421103/2 "2018-03-29T11:41:49Z")

</div>

Thanks to this Tutorial [Graph System](https://wiki.unrealengine.com/Multi-Threading:_Task_Graph_System)

It’s working now. But i have one question. Is it save to declare the output Array just within the namespace and not in the class?
