//---------------- protected override IBluetoothSecurity GetBluetoothSecurity() { EnsureLoaded(); if (m_btSecurity == null) { m_btSecurity = new WidcommBluetoothSecurity(this); } return(m_btSecurity); }
private void Dispose(bool disposing, bool respectLocks) { IDisposable iface; IDisposable st; //lock (typeof(WidcommBluetoothFactory)) bool gotLock = false; try { if (respectLocks) { Monitor.Enter(typeof(WidcommBluetoothFactory)); gotLock = true; } iface = (IDisposable)s_btInterface; s_btIf = null; s_btInterface = null; m_btSecurity = null; #if KILL_SINGLE_THREAD_AT_DISPOSAL st = _st; _st = null; #else st = null; #endif if (disposing) { _thingsToKeepAlive.Clear(); } } finally { if (gotLock) { Monitor.Exit(typeof(WidcommBluetoothFactory)); } } if (iface != null) { iface.Dispose(); } if (st != null) // Must NOT dispose this first! { st.Dispose(); } }