private void LaunchInternal()
        {
            Environment.SetEnvironmentVariable(_aeronDirDeleteOnStartEnvVar, DeleteDirectoryOnLaunch ? "true" : "false");
            Environment.SetEnvironmentVariable(_aeronDirEnvVar, DirectoryName);
            Environment.SetEnvironmentVariable(_aeronThreadingModeEnvVar, _aeronThreadingModeLookup[ThreadingMode]);

            if (NativeMediaDriver.InitContext(out _context) != 0)
            {
                throw new Exception("Failed to init context");
            }

            if (NativeMediaDriver.InitDriver(out _driver, _context) != 0)
            {
                throw new Exception("Failed to init driver");
            }

            if (NativeMediaDriver.StartDriver(_driver, false) != 0)
            {
                throw new Exception("Failed to start driver");
            }
        }
 public void Dispose()
 {
     NativeMediaDriver.CloseDriver(_driver);
     NativeMediaDriver.CloseContext(_context);
 }