ofThread : new to it, how to have it run simultaneously with main thread?

I’ve created a class that extends ofThread, and it has 1 function that fetches images from an API call and loads them into an array of ofImages.

As of now, in my ofApp setup function, it makes a call to this function, and this prevents the UI from being drawn or interacted with until it is finished loading all the images.

I’m new to multithreading, but I’m wondering how I can make calls to this function and not have to wait for it to finish loading the images before moving onto the rest of the code…run in the background? Not sure if that’s the right terminology, but hopefully that makes sense.

So basically I instantiate my object that extends ofThread, called iAPI, then I do iAPI.getImages(), but I want this function to run simultaneously to the rest of the code after it in the setup function. Any help is appreciated.

There are a few addons that do similar things (downloading images and loading them in a thread). Here is an example:

https://github.com/bakercp/ofxHTTP/tree/master/example_basic_client_loader

And here is another: