Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

BlockTask 类问题 #12

Open
kissMeet opened this issue May 27, 2018 · 3 comments
Open

BlockTask 类问题 #12

kissMeet opened this issue May 27, 2018 · 3 comments
Labels

Comments

@kissMeet
Copy link

BlockTask 类中的是否被唤醒标志Notify应去除static关键字,使之成为成员变量而不是类变量。目前使用static关键字,导致标志位Notify被修改一次变成true后,其他新生成的BlockTask对象的标志位Notify都是true.

@yu199195
Copy link
Member

有测试过吗,我认为static 关键字只是存放在方法区的全局变量,是可以进行修改的

@kissMeet
Copy link
Author

我在使用过程就是遇到这个问题,第一次new出的BlockTask对象Notify属性为false,后面所有new 出的BlockTask对象Notify属性都为true。因为使用了一次signal()方法后,就将静态的Notify属性修改为true了,后面生成的BlockTask对象Notify属性都默认为true了。而且BlockTask是作为对象被使用的,Notify属性应该作为成员变量来使用而不是类变量来使用。

@yu199195 yu199195 added the bug label May 28, 2018
@yu199195
Copy link
Member

bug,修护,我仔细对比了生产环境的代码,确实是没有static修饰的

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants