So i’m after a way to create a thread that slowly loads items that will be used later in the program. I’m not after specifics more of just an idea of how to create such a thread that can be set to do so. I tried to make a thread with min priority, also was thinking of making the thread sleep for a second then run for a second until it is all loaded. I feel like this is a really noobish question and any input would be appreciated! thanks
First explain what you think you mean by “load items to used by the program,” this can mean a few quite different things.
I’m creating items that need to be used by the VBO handler based on the players position, but keep loading more of the items so i dont have to load them every time before the VBO has all of the data added to it. Mainly just to keep from having to run somewhere stop load run again stop load etc.
So precalculate data that will be used to generate a VBO? If it’s actually a problem, sure. Just know that the fastest way to introduce bugs into a program is to add concurrency.
Generally I agree with @BurntPizza, but if you do really need to do this and are new to concurrency, I’d also start by looking at some of the higher level utilities in the JDK, such as ExecutorService and Future, rather than dealing with Threads directly.