doc_is_ready
for (i = 0; !doc_is_ready(docg3) && i < 5; i++)
if (!doc_is_ready(docg3)) {
} while (!doc_is_ready(docg3) && maxWaitCycles--);