checking for messages, then notify, and wait for readSync