public Service(VerifyData data) { _Key = new object(); _Data = data; _Soin = new SpinWait(); _Proxy = new Proxy(new RemotingFactory()); (_Proxy as IUpdatable).Launch(); _ProxyUpdate = new Task(Service._UpdateProxy, new WeakReference<Proxy>(_Proxy)); _ProxyUpdate.Start(); _User = _Proxy.SpawnUser("1"); }
private static void _UpdateProxy(object obj) { var weak = (WeakReference<Proxy>)obj; var spin = new SpinWait(); var counter = new TimeCounter(); while(true) { Proxy proxy; if(weak.TryGetTarget(out proxy) == false) { break; } if(proxy.Enable == false) { break; } IUpdatable updater = proxy; updater.Update(); updater = null; proxy = null; if(counter.Second >= 1.0f) { GC.Collect(); counter.Reset(); } } }