*Noob* AsyncTask task crashing Editor **Edited**

All I really want to know is if I can run a task that’s any length or if its limited by my cpu or the software or something.

I’m trying to create a threaded process to optimize the performance of an algo I originally wrote inside blueprints. I thought it would just run until finished.

In blueprints it had to run on game tick so it had to be subdivided; executing 7000-10000 instructions every tick.

I’m using FAutoDeleteAsyncTask, inside DoWork() I allocate memory for arrays then run a while loop with several nested loops inside it around 70k times, I’d like to be able to exponentially more.

The Editor locks up half a second in. Idk exactly how this stuff works, I thought it would just run on its own to completion. If I have to baby sit it to completion like in blueprints, I’m not sure how to do that accept to split it into a chain of individual tasks each furthering it to completion.

It work fin on the main thread.

I’m sure someone will read this and tell me that dosn’t make any sense, and I’d be relieved to hear that. I’ll just have to keep debugging.

I should add that I’m really new to c++ and programming in general, I think what I want to do is push some of what I’m doing on to a new stack every so often. Does anyone know how to do that?

Try this tutorial: http://orfeasel.com/implementing-multithreading-in-ue4/

Hey, thanks for the response. I should point out the task does run, as it prints to screen after it reserves the TArrays and completes some of the loops that help initialize it. It’s seeming only after it starts the main process it breaks for some reason. Looking through your tutorial there are some things that were done differently so I’ll try that.

It’s possible that it’s not actually running on it s own thread and crashing the editor because I switched from an If statement that ran every tick to a while loop.

I’m marking this answer correct because my question is kind of silly and I don’t have a better way to word it. I think what I need to do is run a sequence of threaded functions opposed to one single function.