Realms.RealmHandle.LockAndUndbindList C# (CSharp) Method

LockAndUndbindList() private method

private LockAndUndbindList ( ) : void
return void
        private void LockAndUndbindList()
        {
            if (_unbindList.Count == 0)
            {
                return;
            }

            // outside the lock so we may get a really strange value here.
            // however. If we get 0 and the real value was something else, we will find out inside the lock in unbindlockedlist
            // if we get !=0 and the real value was in fact 0, then we will just skip and then catch up next time around.
            // however, doing things this way will save lots and lots of locks when the list is empty, which it should be if people have
            // been using the dispose pattern correctly, or at least have been eager at disposing as soon as they can
            // except of course dot notation users that cannot dispose cause they never get a reference in the first place
            lock (_unbindListLock)
            {
                UnbindLockedList();
            }
        }

Usage Example

Exemplo n.º 1
0
 public RealmHandle(RealmHandle root) : base(IntPtr.Zero, true)
 {
     if (root == null) // if we are a root object, we need a list for our children and Root is already null
     {
         _unbindList = GetUnbindList();
     }
     else
     {
         Root = root;
         root.LockAndUndbindList();
     }
 }
All Usage Examples Of Realms.RealmHandle::LockAndUndbindList