You can do a periodic survey to find out if the list has been populated: write a while () loop to check once in a while. Or you can wait a fixed amount of time (for example, 30 ms) before performing the next operation. These are not recommended methods, but they should solve your problem.
source share