AcquireWriteLock() публичный Метод

public AcquireWriteLock ( ) : bool
Результат bool
Пример #1
0
        /// <summary>
        /// Handles simple (safe) changes.
        /// </summary>
        private void ProcessSimpleChange(TextChangeContext context)
        {
            bool elementsRemoved = false;

            try {
                _editorTree.AcquireWriteLock();

                elementsRemoved = DeleteAndShiftElements(context);
                UpdateTreeTextSnapshot();

                // If no elements were invalidated and full parse is not required, clear pending changes
                if (!elementsRemoved)
                {
                    ClearChanges();
                }
            } finally {
                _editorTree.ReleaseWriteLock();
            }

            if (!elementsRemoved)
            {
                if (context.ChangedNode != null || context.PendingChanges.TextChangeType == TextChangeType.Trivial)
                {
                    _editorTree.FireOnPositionsOnlyChanged();
                }

                _editorTree.FireOnUpdateCompleted(TreeUpdateType.PositionsOnly);
            }
            else
            {
                _editorTree.FireOnUpdateCompleted(TreeUpdateType.NodesRemoved);
            }

            DebugTree.VerifyTree(_editorTree);
            Debug.Assert(_editorTree.AstRoot.Children.Count > 0);
        }