public AutoLocker(AutoLock data) : this(C4dApiPINVOKE.new_AutoLocker__SWIG_2(AutoLock.getCPtr(data)), true) { if (C4dApiPINVOKE.SWIGPendingException.Pending) { throw C4dApiPINVOKE.SWIGPendingException.Retrieve(); } }
public void SelectAudioCaptureDevice(MediaDevice device) { using (var @lock = new AutoLock(_lock)) { @lock.WaitAsync().Wait(); _audioCaptureDevice = device; } }
public void SelectVideoDevice(MediaDevice device) { using (var @lock = new AutoLock(_lock)) { @lock.WaitAsync().Wait(); _videoDevice = device; } }
public void DoLock(AutoLock data) { C4dApiPINVOKE.AutoLocker_DoLock(swigCPtr, AutoLock.getCPtr(data)); if (C4dApiPINVOKE.SWIGPendingException.Pending) { throw C4dApiPINVOKE.SWIGPendingException.Retrieve(); } }
public void SetPreferredVideoCaptureFormat(int frameWidth, int frameHeight, int fps) { using (var @lock = new AutoLock(_lock)) { @lock.WaitAsync().Wait(); _preferredFrameWidth = frameWidth; _preferredFrameHeight = frameHeight; _preferredFPS = fps; } }
private void OnFileEvent(object sender, FileEventArgs e) { RemoveInvalidClients(); using (AutoLock.LockToRead(_clients.Lock, 5000)) { foreach (Client client in _clients.Values) { ThreadPool.QueueUserWorkItem(NotifyThreadProc, NotifyThreadStateInfo.Create(client, e)); } } }
/// <summary> /// Initializes the file system with the supplied <c>rootAddress</c>, <c>parentLayer</c> and <c>options</c>. /// </summary> /// <param name="rootAddress"> /// The rootAddress for the file system. All nodes in the file system are relative to the root name.</param> /// <param name="parentLayer"> /// The parent layer for this file system or <c>null</c> if this <see cref="IFileSystem"/> is not layered. /// </param> /// <param name="options"> /// The options for creating this <c>FileSystem.</c> /// </param> protected AbstractFileSystem(INodeAddress rootAddress, IFile parentLayer, FileSystemOptions options) { this.cache = (INodeCache)Activator.CreateInstance(options.NodeCacheType); this.ParentLayer = parentLayer; this.rootAddress = rootAddress; this.Options = options; this.autoLock = new AutoLock(this); InitializeConstruction(rootAddress, parentLayer, options); this.Extenders = CreateExtenders(); CreateSecurityManager(); }
private async Task QueueIceCandidate(RTCIceCandidate candidate) { using (var @lock = new AutoLock(_iceBufferSemaphore)) { await @lock.WaitAsync(); _bufferedIceCandidates.Add(candidate); if (_iceCandidateBufferTimer == null) { // Flush the ice candidates in 100ms. _iceCandidateBufferTimer = new Timer(FlushBufferedIceCandidates, null, 100, Timeout.Infinite); } } }
public async Task WithContextActionAsync(Func <VoipContext, Task> fn) { using (var @lock = new AutoLock(_sem)) { await @lock.WaitAsync(); try { await fn(this); } catch (Exception ex) { Debug.WriteLine(ex.Message); } } }
public async Task WithState(Func <BaseVoipState, Task> fn) { using (var @lock = new AutoLock(_sem)) { await @lock.WaitAsync(); try { await fn(State); } catch (Exception ex) { Debug.WriteLine(ex.Message); } } }
public async Task <TResult> WithContextFuncAsync <TResult>(Func <VoipContext, Task <TResult> > fn) { using (var @lock = new AutoLock(_sem)) { await @lock.WaitAsync(); try { return(await fn(this)); } catch (Exception ex) { Debug.WriteLine(ex.Message); } } return(default(TResult)); }
private async void FlushBufferedIceCandidates(object state) { using (var @lock = new AutoLock(_iceBufferSemaphore)) { await @lock.WaitAsync(); _iceCandidateBufferTimer = null; // Chunk in groups of 10 to not blow the size limit // on the storage used by the receiving side. while (_bufferedIceCandidates.Count > 0) { var candidates = _bufferedIceCandidates.Take(10).ToArray(); _bufferedIceCandidates = _bufferedIceCandidates.Skip(10).ToList(); await WithState(async st => await st.SendLocalIceCandidates(candidates)); } } }
public async Task WithContextActionAsync(Func <CallContext, Task> fn) { using (var autoLock = new AutoLock(_sem)) { await autoLock.WaitAsync(); try { await fn(this); } catch (Exception ex) { Debug.WriteLine(ex.Message); if (Debugger.IsAttached) { throw; } } } }
public async Task WithState(Func <BaseCallState, Task> fn) { using (var autoLock = new AutoLock(_sem)) { await autoLock.WaitAsync(); try { await fn(State); } catch (Exception ex) { Debug.WriteLine(ex.Message); if (Debugger.IsAttached) { throw; } } } }
public async Task <TResult> WithContextFuncAsync <TResult>(Func <CallContext, Task <TResult> > fn) { using (var autoLock = new AutoLock(_sem)) { await autoLock.WaitAsync(); try { return(await fn(this)); } catch (Exception ex) { Debug.WriteLine(ex.Message); if (Debugger.IsAttached) { throw; } } } return(default(TResult)); }
private void RemoveInvalidClients() { List <Guid> removeClientList = new List <Guid>(); using (AutoLock.LockToRead(_clients.Lock, 5000)) { foreach (Client client in _clients.Values) { if (!client.IsValid) { removeClientList.Add(client.Id); } } } foreach (Guid id in removeClientList) { if (_clients.ContainsKey(id)) { _clients.Remove(id); } } }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AutoLock obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
protected AbstractRunnableService() { this.autoLock = new AutoLock(this.SyncLock); }
protected AbstractService() { this.autoLock = new AutoLock(this.SyncLock); }