add do/while waiting instead of arbitrary waiting

SHDP-115