小编asd*_*are的帖子

Updating a boolean value in multithreaded process in Java

I have the following code:

public class CheckIfSame implements Runnable {

private int[][] m;
private int[][] mNew;
private int row;
private boolean same;

public CheckIfSame(int[][] m,int[][] mNew,,int row,boolean same) {
    this.m = m;
    this.mNew = mNew;
    this.row = row;
    this.same = same;
}

@Override
public void run() {
    for (int i = 0; i < mUpd[0].length; i++) {
        if(m[row][i] != mUpd[row][i]) {
            same = false;
        }       
    }

}
Run Code Online (Sandbox Code Playgroud)

}

Basically, the idea of this is that i use multi threading …

java parallel-processing concurrency multithreading

4
推荐指数
1
解决办法
151
查看次数