Skip to content

Loading…

fnQueue clear 无 func 参数时的问题 #2

Closed
wenbing opened this Issue · 1 comment

2 participants

@wenbing

没有 clear 掉 dup 数组:

if (!func) {
    this.length = 0;
}

应该 clear 掉 dup 数组:

if (!func) {
    this.length = 0;
    dup.length = 0;
}
@dexteryy
Owner

dup的作用是支持这种情况:当队列执行过程中,作为成员的函数会移除同一个队列中的成员。所以dup不能简单的跟队列本身一起清空,当func参数存在时也是一样(注意if (dup && i >= popsize)),可以参考这个帖子:#1

@dexteryy dexteryy closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.