mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-02 02:43:06 +03:00
Fix mutex for Free-tread pythons
This commit is contained in:
parent
be3b0fd05c
commit
159ffe3bc3
|
@ -165,9 +165,9 @@ export_single_channel_array(Imaging im, struct ArrowArray *array) {
|
||||||
length = im->xsize * im->lines_per_block;
|
length = im->xsize * im->lines_per_block;
|
||||||
}
|
}
|
||||||
|
|
||||||
MUTEX_LOCK(im->mutex);
|
MUTEX_LOCK(&im->mutex);
|
||||||
im->refcount++;
|
im->refcount++;
|
||||||
MUTEX_UNLOCK(im->mutex);
|
MUTEX_UNLOCK(&im->mutex);
|
||||||
// Initialize primitive fields
|
// Initialize primitive fields
|
||||||
*array = (struct ArrowArray){// Data description
|
*array = (struct ArrowArray){// Data description
|
||||||
.length = length,
|
.length = length,
|
||||||
|
@ -208,9 +208,9 @@ export_fixed_pixel_array(Imaging im, struct ArrowArray *array) {
|
||||||
length = im->xsize * im->lines_per_block;
|
length = im->xsize * im->lines_per_block;
|
||||||
}
|
}
|
||||||
|
|
||||||
MUTEX_LOCK(im->mutex);
|
MUTEX_LOCK(&im->mutex);
|
||||||
im->refcount++;
|
im->refcount++;
|
||||||
MUTEX_UNLOCK(im->mutex);
|
MUTEX_UNLOCK(&im->mutex);
|
||||||
// Initialize primitive fields
|
// Initialize primitive fields
|
||||||
// Fixed length arrays are 1 buffer of validity, and the length in pixels.
|
// Fixed length arrays are 1 buffer of validity, and the length in pixels.
|
||||||
// Data is in a child array.
|
// Data is in a child array.
|
||||||
|
@ -246,9 +246,9 @@ export_fixed_pixel_array(Imaging im, struct ArrowArray *array) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
MUTEX_LOCK(im->mutex);
|
MUTEX_LOCK(&im->mutex);
|
||||||
im->refcount++;
|
im->refcount++;
|
||||||
MUTEX_UNLOCK(im->mutex);
|
MUTEX_UNLOCK(&im->mutex);
|
||||||
*array->children[0] = (struct ArrowArray){// Data description
|
*array->children[0] = (struct ArrowArray){// Data description
|
||||||
.length = length * 4,
|
.length = length * 4,
|
||||||
.offset = 0,
|
.offset = 0,
|
||||||
|
|
|
@ -299,14 +299,14 @@ ImagingDelete(Imaging im) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MUTEX_LOCK(im->mutex);
|
MUTEX_LOCK(&im->mutex);
|
||||||
im->refcount--;
|
im->refcount--;
|
||||||
|
|
||||||
if (im->refcount > 0) {
|
if (im->refcount > 0) {
|
||||||
MUTEX_UNLOCK(im->mutex);
|
MUTEX_UNLOCK(&im->mutex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MUTEX_UNLOCK(im->mutex);
|
MUTEX_UNLOCK(&im->mutex);
|
||||||
|
|
||||||
if (im->palette) {
|
if (im->palette) {
|
||||||
ImagingPaletteDelete(im->palette);
|
ImagingPaletteDelete(im->palette);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user