race condition with wait() function

Hi,
I'm currently writing a bash script, that starts multiple threads:
____________________
#!/bin/bash
loop=0
while((loop!=10))
do
thread &
((loop++))
done

#wait for all sub-processes (thread) to finish
wait
___________________

Now I want to know, what happens, if a sub-process (thread) is finished,
before the main-script gets to the wait parameter.
Will the wait parameter realize, that the thread has already finished or will it wait to infinity?

Thnaks for your help...

Wait will only wait on active child processes. Dead processes (or terminated, or non-existant) will not be waited for.

thank you for your fast answer.