Exemplo n.º 1
0
        private static void ReleaseStorage(AbstractPersistentStorage storage, bool synchronousShutdown)
        {
            if (storage == null)
            {
                return;
            }

            if (synchronousShutdown)
            {
                // dispose storage outside of the lock
                storage.Dispose();
            }
            else
            {
                // make it to shutdown asynchronously
                Task.Run(() => storage.Dispose());
            }
        }
Exemplo n.º 2
0
        public void UnregisterPrimarySolution(SolutionId solutionId, bool synchronousShutdown)
        {
            AbstractPersistentStorage storage = null;

            lock (_lookupAccessLock)
            {
                if (_primarySolutionId == null)
                {
                    // primary solution is never registered or already unregistered
                    Contract.ThrowIfTrue(_primarySolutionStorage != null);
                    return;
                }

                Contract.ThrowIfFalse(_primarySolutionId == solutionId);

                _primarySolutionId = null;
                if (_primarySolutionStorage == null)
                {
                    // primary solution is registered but no C#/VB project was added
                    return;
                }

                storage = _primarySolutionStorage;
                _primarySolutionStorage = null;
            }

            if (storage != null)
            {
                if (synchronousShutdown)
                {
                    // dispose storage outside of the lock
                    storage.Dispose();
                }
                else
                {
                    // make it to shutdown asynchronously
                    Task.Run(() => storage.Dispose());
                }
            }
        }