private static void UpdateAutocompleteCacheThread()
{
while (true)
{
Thread.Sleep(50);
if (_scriptToUpdateInBackground != null)
{
Script scriptToUpdate;
lock (_scriptLockObject)
{
scriptToUpdate = _scriptToUpdateInBackground;
_scriptToUpdateInBackground = null;
}
try
{
OnBackgroundCacheUpdateStatusChanged(BackgroundAutoCompleteStatus.Processing, null);
ConstructCache(scriptToUpdate, true);
OnBackgroundCacheUpdateStatusChanged(BackgroundAutoCompleteStatus.Finished, null);
}
catch (Exception ex)
{
OnBackgroundCacheUpdateStatusChanged(BackgroundAutoCompleteStatus.Error, ex);
}
}
}
}