Skip to content
Merged
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
Next Next commit
Use Py.GIL directly, now that it doesn't try to init anymore
  • Loading branch information
filmor committed May 4, 2022
commit 5eccd45a7ed9b4fddc9345fad1f7f63fa5d0adf3
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