Skip to content

Commit 6e66166

Browse files
authored
Merge pull request #8623 from radarhere/threads
2 parents 0e3f51d + 62b7cb6 commit 6e66166

File tree

2 files changed

+36
-34
lines changed

2 files changed

+36
-34
lines changed

src/_imagingcms.c

+28-28
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,10 @@ pyCMSdoTransform(Imaging im, Imaging imOut, cmsHTRANSFORM hTransform) {
346346
return -1;
347347
}
348348

349-
Py_BEGIN_ALLOW_THREADS
349+
Py_BEGIN_ALLOW_THREADS;
350350

351-
// transform color channels only
352-
for (i = 0; i < im->ysize; i++) {
351+
// transform color channels only
352+
for (i = 0; i < im->ysize; i++) {
353353
cmsDoTransform(hTransform, im->image[i], imOut->image[i], im->xsize);
354354
}
355355

@@ -362,9 +362,9 @@ pyCMSdoTransform(Imaging im, Imaging imOut, cmsHTRANSFORM hTransform) {
362362
// enough available on all platforms, so we polyfill it here for now.
363363
pyCMScopyAux(hTransform, imOut, im);
364364

365-
Py_END_ALLOW_THREADS
365+
Py_END_ALLOW_THREADS;
366366

367-
return 0;
367+
return 0;
368368
}
369369

370370
static cmsHTRANSFORM
@@ -378,17 +378,17 @@ _buildTransform(
378378
) {
379379
cmsHTRANSFORM hTransform;
380380

381-
Py_BEGIN_ALLOW_THREADS
381+
Py_BEGIN_ALLOW_THREADS;
382382

383-
/* create the transform */
384-
hTransform = cmsCreateTransform(
385-
hInputProfile,
386-
findLCMStype(sInMode),
387-
hOutputProfile,
388-
findLCMStype(sOutMode),
389-
iRenderingIntent,
390-
cmsFLAGS
391-
);
383+
/* create the transform */
384+
hTransform = cmsCreateTransform(
385+
hInputProfile,
386+
findLCMStype(sInMode),
387+
hOutputProfile,
388+
findLCMStype(sOutMode),
389+
iRenderingIntent,
390+
cmsFLAGS
391+
);
392392

393393
Py_END_ALLOW_THREADS;
394394

@@ -412,19 +412,19 @@ _buildProofTransform(
412412
) {
413413
cmsHTRANSFORM hTransform;
414414

415-
Py_BEGIN_ALLOW_THREADS
416-
417-
/* create the transform */
418-
hTransform = cmsCreateProofingTransform(
419-
hInputProfile,
420-
findLCMStype(sInMode),
421-
hOutputProfile,
422-
findLCMStype(sOutMode),
423-
hProofProfile,
424-
iRenderingIntent,
425-
iProofIntent,
426-
cmsFLAGS
427-
);
415+
Py_BEGIN_ALLOW_THREADS;
416+
417+
/* create the transform */
418+
hTransform = cmsCreateProofingTransform(
419+
hInputProfile,
420+
findLCMStype(sInMode),
421+
hOutputProfile,
422+
findLCMStype(sOutMode),
423+
hProofProfile,
424+
iRenderingIntent,
425+
iProofIntent,
426+
cmsFLAGS
427+
);
428428

429429
Py_END_ALLOW_THREADS;
430430

src/display.c

+8-6
Original file line numberDiff line numberDiff line change
@@ -690,24 +690,26 @@ PyImaging_CreateWindowWin32(PyObject *self, PyObject *args) {
690690
SetWindowLongPtr(wnd, 0, (LONG_PTR)callback);
691691
SetWindowLongPtr(wnd, sizeof(callback), (LONG_PTR)PyThreadState_Get());
692692

693-
Py_BEGIN_ALLOW_THREADS ShowWindow(wnd, SW_SHOWNORMAL);
693+
Py_BEGIN_ALLOW_THREADS;
694+
ShowWindow(wnd, SW_SHOWNORMAL);
694695
SetForegroundWindow(wnd); /* to make sure it's visible */
695-
Py_END_ALLOW_THREADS
696+
Py_END_ALLOW_THREADS;
696697

697-
return Py_BuildValue(F_HANDLE, wnd);
698+
return Py_BuildValue(F_HANDLE, wnd);
698699
}
699700

700701
PyObject *
701702
PyImaging_EventLoopWin32(PyObject *self, PyObject *args) {
702703
MSG msg;
703704

704-
Py_BEGIN_ALLOW_THREADS while (mainloop && GetMessage(&msg, NULL, 0, 0)) {
705+
Py_BEGIN_ALLOW_THREADS;
706+
while (mainloop && GetMessage(&msg, NULL, 0, 0)) {
705707
TranslateMessage(&msg);
706708
DispatchMessage(&msg);
707709
}
708-
Py_END_ALLOW_THREADS
710+
Py_END_ALLOW_THREADS;
709711

710-
Py_INCREF(Py_None);
712+
Py_INCREF(Py_None);
711713
return Py_None;
712714
}
713715

0 commit comments

Comments
 (0)