waits until a certain function returns true and then executes a code.