Reputation: 623
I've never really used threading before in C# where I need to have six threads which need to be execute at the same time. Here is the sample steps
1-User will invoke a print request
2- Need to create 5 thread in the background. This will invoke at the same time and These five thread will create five PDF document.
3- Merge five documents and send response back to the user.
Is it possible to handle this by using multi threading in C#. If possible how can i hold initial request.
Additional. Is t possible to make number of thread in a dynamic way.(I mean some time 5 thread sometime 6...)
Please help me to make a good decision
Thanks
Upvotes: 0
Views: 122
Reputation: 2741
Looking for some thing like this
var task1 = Task.Run(() => Funct1());
var task2 = Task.Run(() => Funct2());
var task3 = Task.Run(() => Funct3());
var task4 = Task.Run(() => Funct4());
var task5 = Task.Run(() => Funct5());
int totalSlept = task1.Result + task2.Result+task3.Result + task4.Result+task5.Result
Upvotes: 1