Last active
August 29, 2015 14:01
-
-
Save thushan/66c104e0825e57a315df to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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