I have a problem using Microsoft Solver Foundation in my multithreaded C # application:
I start two threads at the same time and in each thread, which calls the function as follows:
private void exampleFunction() { SolverContext context; Model model; for(int i=0;i<10;i++) { context = SolverContext.GetContext(); model = context.CreateModel();
It seems that the context that I have in each thread is the same object, so when I call
context.ClearModel();
in thread1, then it is also cleared in thread2 (even if the problem in thread2 has not yet been resolved).
So the question is: is there a way to solve two models at the same time in MSF? Is it possible to declare two SolverContext that will not be the same?
source share