Skip to content

Fix for Issue #84 - Extract call to git_threads_init into a separate, non-inlined method so ... #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 23, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion LibGit2Sharp/Core/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using LibGit2Sharp.Core.Handles;

Expand All @@ -27,10 +28,18 @@ static NativeMethods()
String.Format(CultureInfo.InvariantCulture, "{0}{1}{2}", path, Path.PathSeparator, Environment.GetEnvironmentVariable(pathEnvVariable)));
}

git_threads_init();
GitInit();
AppDomain.CurrentDomain.ProcessExit += ThreadsShutdown;
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static void GitInit()
{
// keep this in a separate method so mono can JIT the .cctor
// and adjust the PATH before trying to load the native library
git_threads_init();
}

private static void ThreadsShutdown(object sender, EventArgs e)
{
git_threads_shutdown();
Expand Down