Background Task || Help me understand this please.
-
I have a heavy token parsing function that crashes when I query large directories. I was told to execute this function on a 'background thread' so I've been looking into it. I just need some clarification from someone with experience with this please.
I have this function:
inline function onbtnFindTokenControl(component, value) { // Search files here } btnFindToken.setControlCallback(onbtnFindTokenControl);This function is triggered with a Button on my interface labeled "LOAD".
Based on what i've read so far....is this pretty much how you do this?
inline function onbtnFindTokenControl(component, value) { // Search files here } btnFindToken.setControlCallback(onbtnFindTokenControl); BackgroundTask.callOnBackgroundThread(onbtnFindTokenControl); // I could put this into the button callback and changed my button callback to // a regular inline function.....is this correct? -
@Chazrox place your parsing code in a separated function. Then in the button callback, call the background task for the parsing function.
You shouldn't pass the button callback itself -
@ustk Sweet. So other than that, is that pretty much the process?
I have helper functions that are called inside of my parsing script but exist outside of my function. Do those need to be dealt with specifically or are they automatically handled on the background thread also because they are called from within my background function?