ae4f575911
This change checks for isCancelled() inside the loop to be able to terminate the thread as early as possible.