Public void setValue (int value) {
This value=https://bbs.csdn.net/topics/value;
}
Public int getValue () {
Return this. The value;
}
If A and B have two threads, A call setValue method first, and then call the getValue method B, then B threads execute () method returns the result of is what?
I'm still not sure, reorder volatile banned within A thread code, does not ensure thread B by the end of A thread to execute later, in the execution thread scheduling may occur at any time
CodePudding user response:
Put a thread priority setting into higher than b if I can solveCodePudding user response:
I remember the teacher said, we also tested, weight is very small