Skip to content

On shutdown from Python release all slot holders #1720

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

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Use Py.GIL directly, now that it doesn't try to init anymore
  • Loading branch information
filmor committed Mar 10, 2022
commit 958c3210093fd73e2da756412bd9dc395e3b49ab
25 changes: 4 additions & 21 deletions src/runtime/Loader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,8 @@ public unsafe static int Initialize(IntPtr data, int size)
PythonDLL = null;
}

var gs = PyGILState_Ensure();

try
{
// Console.WriteLine("Startup thread");
PythonEngine.InitExt();
// Console.WriteLine("Startup finished");
}
finally
{
PyGILState_Release(gs);
}
using var _ = Py.GIL();
PythonEngine.InitExt();
}
catch (Exception exc)
{
Expand All @@ -55,15 +45,8 @@ public unsafe static int Shutdown(IntPtr data, int size)

if (command == "full_shutdown")
{
var gs = PyGILState_Ensure();
try
{
PythonEngine.Shutdown();
}
finally
{
PyGILState_Release(gs);
}
using var _ = Py.GIL();
PythonEngine.Shutdown();
}
}
catch (Exception exc)
Expand Down