| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,18 +23,8 @@ public unsafe static int Initialize(IntPtr data, int size) | |||
| 23 | 23 | PythonDLL = null; | |
| 24 | 24 | } | |
| 25 | 25 | ||
| 26 | - var gs = PyGILState_Ensure(); | ||
| 27 | - | ||
| 28 | - try | ||
| 29 | - { | ||
| 30 | - // Console.WriteLine("Startup thread"); | ||
| 31 | - PythonEngine.InitExt(); | ||
| 32 | - // Console.WriteLine("Startup finished"); | ||
| 33 | - } | ||
| 34 | - finally | ||
| 35 | - { | ||
| 36 | - PyGILState_Release(gs); | ||
| 37 | - } | ||
| 26 | + using var _ = Py.GIL(); | ||
| 27 | + PythonEngine.InitExt(); | ||
| 38 | 28 | } | |
| 39 | 29 | catch (Exception exc) | |
| 40 | 30 | { | |
@@ -55,15 +45,8 @@ public unsafe static int Shutdown(IntPtr data, int size) | |||
| 55 | 45 | ||
| 56 | 46 | if (command == "full_shutdown") | |
| 57 | 47 | { | |
| 58 | - var gs = PyGILState_Ensure(); | ||
| 59 | - try | ||
| 60 | - { | ||
| 61 | - PythonEngine.Shutdown(); | ||
| 62 | - } | ||
| 63 | - finally | ||
| 64 | - { | ||
| 65 | - PyGILState_Release(gs); | ||
| 66 | - } | ||
| 48 | + using var _ = Py.GIL(); | ||
| 49 | + PythonEngine.Shutdown(); | ||
| 67 | 50 | } | |
| 68 | 51 | } | |
| 69 | 52 | catch (Exception exc) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments