fun completeAll() { val currentCompleted: Long = completedCount val size = Math.max(1, actionList.size()) while (completedCount - currentCompleted < size) { if (getState() !== Thread.State.BLOCKED && getState() !== Thread.State.RUNNABLE) break try { Thread.sleep(50) } catch (ex: InterruptedException) { break } } }
< p > Complete all scheduled actions at the time of this call . Since other threads may keep adding actions , this method makes sure that only the actions in the queue at the time of the call are waited upon . < /p >