you can use a condition and then wait & notify, but this would work too.