Code Stage - Multithreading

Andrew_G

New Member
Hello. We are experimenting with multithreading in C# within a blue prism code stage.

We have a few devs that work lightly in C# and this has stumped them.

We have an larger end goal, however a simple test will suffice for proof of concept to continue. I created this simple setup, it throws no errors when checking code, but simply doesn't pause at all like its not executing as it should.

Any help would be most appreciated. Thank you

C#:
//Simple method to pass in a number, which is cast to an int and then the thread should sleep for the given time.
//Global Code
static void MultiThreading(object x)
{
 int z =(int)x;
 Thread.Sleep(z);
}

C#:
// sets up variables and creates threads before starting them.  This part doesn't seem to execute right
//Code Stage
int y = 5000;
int x = 5000;
Thread thr1 = new Thread(MultiThreading);
Thread thr2 = new Thread(MultiThreading);

thr1.Start(y);
thr2.Start(z);
 
Top