Skip to content

Instantly share code, notes, and snippets.

@thushan
Last active August 29, 2015 14:01
Show Gist options
  • Save thushan/66c104e0825e57a315df to your computer and use it in GitHub Desktop.
Save thushan/66c104e0825e57a315df to your computer and use it in GitHub Desktop.
public class Bootstrap
{
public IDisposable Initialise()
{
var jitc = new NitroGcCompiler(Options.AggresiveGc);
var runtime = new ServerRuntime(jitc, Gc.VaryByLoad | Gc.NoTrace);
// Configure Runtime & JitC
return new Disposable(() =>
{
runtime.Dispose();
jitc.Dispose();
});
}
}
private class Disposable : IDisposable
{
private Action _dispose;
public Disposable(Action dispose)
{
_dispose = dispose;
}
public void Dispose()
{
Interlocked.Exchange(ref _dispose, () => { }).Invoke();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment