Merge pull request #8623 from radarhere/threads

This commit is contained in:
Hugo van Kemenade 2024-12-26 22:17:44 +02:00 committed by GitHub
commit 6e66166234
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 35 additions and 33 deletions

View File

@ -346,7 +346,7 @@ pyCMSdoTransform(Imaging im, Imaging imOut, cmsHTRANSFORM hTransform) {
return -1;
}
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS;
// transform color channels only
for (i = 0; i < im->ysize; i++) {
@ -362,7 +362,7 @@ pyCMSdoTransform(Imaging im, Imaging imOut, cmsHTRANSFORM hTransform) {
// enough available on all platforms, so we polyfill it here for now.
pyCMScopyAux(hTransform, imOut, im);
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS;
return 0;
}
@ -378,7 +378,7 @@ _buildTransform(
) {
cmsHTRANSFORM hTransform;
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS;
/* create the transform */
hTransform = cmsCreateTransform(
@ -412,7 +412,7 @@ _buildProofTransform(
) {
cmsHTRANSFORM hTransform;
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS;
/* create the transform */
hTransform = cmsCreateProofingTransform(

View File

@ -690,9 +690,10 @@ PyImaging_CreateWindowWin32(PyObject *self, PyObject *args) {
SetWindowLongPtr(wnd, 0, (LONG_PTR)callback);
SetWindowLongPtr(wnd, sizeof(callback), (LONG_PTR)PyThreadState_Get());
Py_BEGIN_ALLOW_THREADS ShowWindow(wnd, SW_SHOWNORMAL);
Py_BEGIN_ALLOW_THREADS;
ShowWindow(wnd, SW_SHOWNORMAL);
SetForegroundWindow(wnd); /* to make sure it's visible */
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS;
return Py_BuildValue(F_HANDLE, wnd);
}
@ -701,11 +702,12 @@ PyObject *
PyImaging_EventLoopWin32(PyObject *self, PyObject *args) {
MSG msg;
Py_BEGIN_ALLOW_THREADS while (mainloop && GetMessage(&msg, NULL, 0, 0)) {
Py_BEGIN_ALLOW_THREADS;
while (mainloop && GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS;
Py_INCREF(Py_None);
return Py_None;