Skip to content

Commit

Permalink
Merge remote branch 'origin/HEAD'
Browse files Browse the repository at this point in the history
Conflicts:
	src/Ninject/GlobalKernelRegistry.cs
  • Loading branch information
remogloor committed Nov 23, 2011
2 parents 0dd282e + d966f0d commit 75be303
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/Ninject/Activation/Caching/GarbageCollectionCachePruner.cs
Expand Up @@ -23,13 +23,19 @@ namespace Ninject.Activation.Caching
/// </summary>
public class GarbageCollectionCachePruner : NinjectComponent, ICachePruner
{
/// <summary>
/// indicator for if GC has been run.
/// </summary>
private readonly WeakReference indicator = new WeakReference(new object());

/// <summary>
/// The caches that are being pruned.
/// </summary>
private readonly List<IPruneable> caches = new List<IPruneable>();

/// <summary>
/// The timer used to trigger the cache pruning
/// </summary>
private Timer timer;

/// <summary>
Expand Down Expand Up @@ -65,10 +71,18 @@ public void Start(IPruneable pruneable)
/// </summary>
public void Stop()
{
this.timer.Change(Timeout.Infinite, Timeout.Infinite);
this.timer.Dispose();
this.timer = null;
this.caches.Clear();
using (var signal = new ManualResetEvent(false))
{
#if !NETCF
this.timer.Dispose(signal);
signal.WaitOne();
#else
this.timer.Dispose();
#endif

this.timer = null;
this.caches.Clear();
}
}

private void PruneCacheIfGarbageCollectorHasRun(object state)
Expand Down

0 comments on commit 75be303

Please sign in to comment.