Exemple #1
0
        /// <summary>
        /// Reloads the modules from the interpreter.
        ///
        /// This method should be called on the analysis thread and is usually invoked
        /// when the interpreter signals that it's modules have changed.
        /// </summary>
        public async Task ReloadModulesAsync()
        {
            if (!_reloadLock.Wait(0))
            {
                // If we don't lock immediately, wait for the current reload to
                // complete and then return.
                await _reloadLock.WaitAsync().ConfigureAwait(false);

                _reloadLock.Release();
                return;
            }

            try {
                _modules.ReInit();
                await LoadKnownTypesAsync().ConfigureAwait(false);

                _interpreter.Initialize(this);

                foreach (var mod in _modulesByFilename.Values)
                {
                    mod.Clear();
                }
            } finally {
                _reloadLock.Release();
            }
        }
        /// <summary>
        /// Reloads the modules from the interpreter.
        ///
        /// This method should be called on the analysis thread and is usually invoked
        /// when the interpreter signals that it's modules have changed.
        /// </summary>
        public void ReloadModules()
        {
            _modules.ReInit();
            LoadKnownTypes();

            _interpreter.Initialize(this);

            foreach (var mod in _modulesByFilename.Values)
            {
                mod.Clear();
            }
        }