Skip to content

Commit c51a13f

Browse files
committed
Turn Py_Begin_Allow_Threads and Py_End_Allow_Threads into class procedures
1 parent 9f0d4cc commit c51a13f

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

Source/PythonEngine.pas

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2637,20 +2637,21 @@ TPyVar = class(TPyObject)
26372637
TPythonThread = class(TThread)
26382638
private
26392639
fThreadState: PPyThreadState;
2640-
f_savethreadstate: PPyThreadState;
26412640
fThreadExecMode: TThreadExecMode;
2641+
private class threadvar
2642+
f_savethreadstate: PPyThreadState;
26422643

26432644
// Do not overwrite Execute! Use ExecuteWithPython instead!
26442645
procedure Execute; override;
26452646
protected
26462647
procedure ExecuteWithPython; virtual; abstract;
26472648

2648-
procedure Py_Begin_Allow_Threads;
2649-
procedure Py_End_Allow_Threads;
2649+
class procedure Py_Begin_Allow_Threads;
2650+
class procedure Py_End_Allow_Threads;
26502651
// The following procedures are redundant and only for
26512652
// compatibility to the C API documentation.
2652-
procedure Py_Begin_Block_Threads;
2653-
procedure Py_Begin_Unblock_Threads;
2653+
class procedure Py_Begin_Block_Threads;
2654+
class procedure Py_Begin_Unblock_Threads;
26542655

26552656
public
26562657
property ThreadState : PPyThreadState read fThreadState;
@@ -8600,24 +8601,24 @@ procedure TPythonThread.Execute;
86008601
end;
86018602

86028603

8603-
procedure TPythonThread.Py_Begin_Allow_Threads;
8604+
class procedure TPythonThread.Py_Begin_Allow_Threads;
86048605
begin
86058606
with GetPythonEngine do
86068607
f_savethreadstate := PyEval_SaveThread;
86078608
end;
86088609

8609-
procedure TPythonThread.Py_End_Allow_Threads;
8610+
class procedure TPythonThread.Py_End_Allow_Threads;
86108611
begin
86118612
with GetPythonEngine do
8612-
PyEval_RestoreThread( f_savethreadstate);
8613+
PyEval_RestoreThread(f_savethreadstate);
86138614
end;
86148615

8615-
procedure TPythonThread.Py_Begin_Block_Threads;
8616+
class procedure TPythonThread.Py_Begin_Block_Threads;
86168617
begin
86178618
Py_End_Allow_Threads;
86188619
end;
86198620

8620-
procedure TPythonThread.Py_Begin_Unblock_Threads;
8621+
class procedure TPythonThread.Py_Begin_Unblock_Threads;
86218622
begin
86228623
Py_Begin_Allow_Threads;
86238624
end;

0 commit comments

Comments
 (0)