public void Add(TKey key, TValue value) { using (ReadLock readLock = new ReadLock(this.readerWriterLockSlim_0)) { this.dict.Add(key, value); } }
public void Clear() { using (ReadLock readLock = new ReadLock(this.readerWriterLockSlim_0)) { this.dict.Clear(); } }
public void Update(Controllers.BaseControllers controllers, GameObject ownerEnt, double dt) { using (UpgradeableReadLock.CreateLock(m_componentsAddQueueLock)) { foreach (var comp in m_componentsAddQueue) { AddComponent(comp); } using (WriteLock.CreateLock(m_componentsAddQueueLock)) { m_componentsAddQueue.Clear(); } } using (WriteLock.CreateLock(m_componentsRemoveQueueLock)) { foreach (var comp in m_componentsRemoveQueue) { m_componentsSorted.Remove(comp); } m_componentsRemoveQueue.Clear(); } using (ReadLock.CreateLock(m_componentsSortedLock)) { foreach (var component in m_componentsSorted) { component.Value.Tick(controllers, ownerEnt, dt); } } }
protected async override void OnBindingContextChanged() { base.OnBindingContextChanged(); if (!CreatedByTinyMvvm && BindingContext is ViewModelBase viewModel) { SetupUIAction(viewModel); try { if (TinyId != null) { var shellNavigationHelper = (ShellNavigationHelper)NavigationHelper.Current; var parameters = shellNavigationHelper.GetQueryParameters(TinyId); viewModel.NavigationParameter = parameters; } await ReadLock.WaitAsync(); await viewModel.Initialize(); } finally { ReadLock.Release(); } } }
public bool IsContain(int ID) { using (ReadLock.TryEnter(this.readerWriterLockSlim, 1000)) { return(Clients.ContainsKey(ID)); } }
public bool IsContain(string name) { using (ReadLock.TryEnter(this.readWriteLock, 1000)) { return(Clients.Exists(n => n.CharacterName.Equals(name))); } }
public UnityClient TryGetByName(string name) { using (ReadLock.TryEnter(this.readWriteLock, 1000)) { return(Clients.Find(n => n.CharacterName.Equals(name))); } }
public void AddClient(UnityClient client) { using (ReadLock.TryEnter(this.readWriteLock, 1000)) { Clients.Add(client); } }
protected virtual void Dispose(bool disposing) { if (_Disposed) { return; } if (disposing) { if (_SslStream != null) { _SslStream.Close(); } if (_NetworkStream != null) { _NetworkStream.Close(); } if (_TcpClient != null) { _TcpClient.Close(); } } ReadLock.Dispose(); WriteLock.Dispose(); _Disposed = true; }
public void RemoveClient(UnityClient client) { using (ReadLock.TryEnter(this.readWriteLock, 1000)) { Clients.Remove(client); } }
public void TestReadLockTimeout() { using (ILockStrategy l = LockFactory.Create()) using (new ThreadedWriter(l)) using (ReadLock r = new ReadLock(l, 0)) Assert.IsFalse(r.HasReadLock); }
/// <summary> /// The try get. /// </summary> /// <param name="name"> /// The world name. /// </param> /// <param name="world"> /// The world. /// </param> /// <returns> /// true if found. /// </returns> public bool TryGet(string name, out MmoWorld world) { using (ReadLock.TryEnter(this.readWriteLock, Settings.MaxLockWaitTimeMilliseconds)) { return(this.dict.TryGetValue(name, out world)); } }
public bool Contains(int actorId) { using (ReadLock.Enter(_actorsLock)) { return(_actors.ContainsKey(actorId)); } }
public virtual void Add(KeyValuePair <TKey, TValue> item) { using (ReadLock readLock = new ReadLock(this.readerWriterLockSlim_0)) { this.dict.Add(item); } }
public bool TryGetItem(string itemId, out Item item) { using (ReadLock.TryEnter(this.readerWriterLock, this.maxLockMilliseconds)) { return(this.items.TryGetValue(itemId, out item)); } }
public void TestYouCanDisposeReadLock() { using (ILockStrategy l = LockFactory.Create()) using (IDisposable r = ReadLock.Acquire(l, 0)) { r.Dispose();//since the using statement has the same boxed pointer to r, we are allowed to dispose } }
public bool ContainsComponents <TComponent1, TComponent2>() where TComponent1 : IComponent where TComponent2 : IComponent { using (ReadLock.Enter(_lock)) { return(_components.ContainsComponents <TComponent1, TComponent2>()); } }
public bool TryGetPeer(HttpContext context, string connectionId, out PhotonHttpPeer peer) { using (ReadLock.Enter(this.readerWriterLock)) { peer = context.Cache.Get(connectionId) as PhotonHttpPeer; } return(peer != null); }
public static IDisposable Reader(bool canReadUnfrozen = false) { IDisposable l = new ReadLock(ConfigurationLock); if (canReadUnfrozen || _isFrozen) return l; l.Dispose(); throw new InvalidOperationException("Resolution is not frozen, it is not yet possible to get values from it."); }
public void Execute() { using(var myLock = new ReadLock()) //Noncompliant { int a = 4; int fun= somefun(); } }
public void AddMessage(string message) { using (ReadLock.TryEnter(this.readWriteLock, 1000)) { Messages.Add(message); if (Messages.Count > MAX_BUFFERED_MESSAGES) Messages = Messages.Skip(Messages.Count - MAX_RECENT_MESSAGES).ToList(); } }
public void TestIdiotReaderUsesDispose() { using (ILockStrategy l = LockFactory.Create()) using (ReadLock r = new ReadLock(l, 0)) { Assert.IsTrue(r.HasReadLock); ((IDisposable)r).Dispose(); //You cannot do this, the using statement has a 'copy' of ReadLock, don't call dispose. } }
public void Reset() { using (var wl = new ReadLock(this.StreamsLock)) { foreach (FifoStream audiostream in this.streams) { audiostream.Clear(); } } }
public void OpenWrite() { using (var wl = new ReadLock(this.StreamsLock)) { foreach (FifoStream audiostream in this.streams) { audiostream.OpenWrite(); } } }
public bool Remove(KeyValuePair <TKey, TValue> item) { bool flag; using (ReadLock readLock = new ReadLock(this.readerWriterLockSlim_0)) { flag = this.dict.Remove(item); } return(flag); }
public bool Remove(TKey key) { bool flag; using (ReadLock readLock = new ReadLock(this.readerWriterLockSlim_0)) { flag = this.dict.Remove(key); } return(flag); }
private void CompliantPositiveCheckCoversComplete() { using (var domainLock = new ReadLock(MarkerInterpretation, SeismicInterpretation)) { if (domainLock.LockApplied) { int a = 10; } } }
public void SetSetAudio(FifoStream audiostream, bool muted, float volume) { using (var rl = new ReadLock(this.StreamsLock)) { int ind = streams.IndexOf(audiostream); if (ind != -1) { this.streaminfo[ind].Set(muted, volume); } } }
public void imethod_0(TKey gparam_0, TValue gparam_1) { using (ReadLock readLock = new ReadLock(this.readerWriterLockSlim_0)) { if (this.dict.ContainsKey(gparam_0)) { this.dict.Remove(gparam_0); } this.dict.Add(gparam_0, gparam_1); } }
public bool TryGet(int actorId, out Actor actor) { bool result; using (ReadLock.Enter(_actorsLock)) { result = _actors.TryGetValue(actorId, out actor); } return(result); }
public float[] GetAudioLevels(FifoStream audiostream) { using (var wl = new ReadLock(this.StreamsLock)) { int ind = streams.IndexOf(audiostream); if (ind == -1) { return(new float[0]); } return(this.streaminfo[ind].audiolevel); } }
public static IDisposable Reader(bool canReadUnfrozen = false) { IDisposable l = new ReadLock(ConfigurationLock); if (canReadUnfrozen || _isFrozen) { return(l); } l.Dispose(); throw new InvalidOperationException("Resolution is not frozen, it is not yet possible to get values from it."); }
public void CloseWrite() { using (var wl = new ReadLock(this.StreamsLock)) { for (int nit = 0; nit < this.streams.Count; nit++) { if (this.streaminfo[nit].running) { this.streams[nit].CloseWrite(); } } } }
private void CompliantPositiveCheckCoversComplete() { for (int i = 0; ;) { using (var domainLock = new ReadLock(MarkerInterpretation, SeismicInterpretation)) { if (!domainLock.LockApplied) { continue; } } } }