Why would try/finally rather than a “using” statement help avoid a race condition?
Yeah, there is a possible race in the using statement. The C# compiler transforms using (var obj = new Foo()) { // statements } to: var obj = new Foo(); try { // statements } finally { if (obj != null) obj.Dispose(); } The race occurs when the thread is aborted right between the obj … Read more