Answer the question
In order to leave comments, you need to log in
How to trick the C# optimizer?
There is this code:
public IEnumerable<NodeBase> GetServerSpace(IsoConnectionParameters connectionParameters)
{
_isWait = true;
var worker = new Scsm_MMS_Worker(new Env());
Task.Factory.StartNew(() =>
{
worker.Start(connectionParameters, ReturnIedTree, string.Empty);
while (_isWait)
{
}
}).Wait();
worker.Stop();
return _node;
}
private bool _isWait;
public IEnumerable<NodeBase> GetServerSpace(IsoConnectionParameters connectionParameters)
{
_isWait = true;
var worker = new Scsm_MMS_Worker(new Env());
Task.Factory.StartNew(() =>
{
worker.Start(connectionParameters, ReturnIedTree, string.Empty);
while (_isWait)
{
Trace.WriteLine("");
}
}).Wait();
worker.Stop();
return _node;
}
Answer the question
In order to leave comments, you need to log in
It is clear that the problem can be solved differently, but it seems to me that you should look towards CancellationTokenSource.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question