Threads don't work the same for pc and android?

I implemented a thread for my unity project and it works fine on pc but it is broken for the android.
The thread is running a recursion and for some reason teh values returned are messed up. Can;t really explain what happens there yet though

What I do is create the thread on another script and run the method…is this the way to go for android apps?

this is my thread:

  public int GetPCNextTurn(int[][] board,int height,int width,int sequence)
        {
            
                this.height = height;
                this.width = width;
                this.sequence = sequence;
             
            
            this.board = board;
           
            weights= GetWeights(sequence);

             CompPlayTurn(board,weights);

 Thread myThread = new Thread(() => CompPlayTurn(board, weights));
     myThread.Start();

return col2play;
        }

The pc used to mess the board I sent it (the code ruins the board with teh recursion but for some reason the change becomes permanent when using threads ) so I send a copy of the board.

But the android not only messes the board still, but the value returned is always the same…

Basically I have a recursion AI that should return the move to take, and this is what I ;d like to put in a thread…

Any suggestions?

Well, threads should work pretty much the exact same… the primary difference between the different architecture would be timing. You probably have a race condition that’s not triggering on PC due to the way PCs (specifically their CPUs) are optimized for multithreading. That’s one of the biggest pitfalls of theads, and one of the hardest to diagnose, but there are good articles online if you search for ‘thread race condition’.

You might want to work with a promise library…