public ThreadObject CreateAndGetResults(string content) { ThreadObject obj; if (_threadObjectsPool.TryGetValue(Thread.CurrentThread.ManagedThreadId, out obj)) { return(obj); } obj = new ThreadObject() { StringContent = content }; while (_lockVersion + 1 != Interlocked.Increment(ref _lockVersion)) { _threadObjectsPool.Add(Thread.CurrentThread.ManagedThreadId, new ThreadObject { StringContent = content }); Thread.Sleep(1); } return(obj); }
public Director(IBuilder builder, string content) { _result = builder.CreateAndGetResults(content); }