// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
namespace ICSharpCode.SharpDevelop.Dom
{
static class DomCache
{
///
/// Clear the static searchclass cache. You should call this method
/// whenever the DOM changes.
///
///
/// automatically called by DefaultProjectContent.UpdateCompilationUnit
/// and DefaultProjectContent.OnReferencedContentsChanged.
///
public static void Clear()
{
List oldActions;
lock (lockObject) {
oldActions = actions;
actions = new List();
}
foreach (Action a in oldActions) {
a();
}
}
static readonly object lockObject = new Object();
static List actions = new List();
public static void RegisterForClear(Action action)
{
lock (lockObject) {
actions.Add(action);
}
}
}
}