Skip to content

Commit bae3bae

Browse files
committed
Make calling the shutdown code conditional for now
1 parent a5fd15a commit bae3bae

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/runtime/loader.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Diagnostics;
12
using System;
23
using System.Runtime.InteropServices;
34
using System.Text;
@@ -49,13 +50,18 @@ public unsafe static int Initialize(IntPtr data, int size)
4950
return 0;
5051
}
5152

52-
public static int Shutdown(IntPtr data, int size)
53+
public unsafe static int Shutdown(IntPtr data, int size)
5354
{
5455
IntPtr gs = IntPtr.Zero;
5556
try
5657
{
57-
gs = PyGILState_Ensure();
58-
PythonEngine.Shutdown();
58+
var command = Encoding.UTF8.GetString((byte*)data.ToPointer(), size);
59+
60+
if (command == "full_shutdown")
61+
{
62+
gs = PyGILState_Ensure();
63+
PythonEngine.Shutdown();
64+
}
5965
}
6066
catch (Exception exc)
6167
{

0 commit comments

Comments
 (0)