mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-01 02:13:11 +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;
|
||||
}
|
||||
|
||||
MUTEX_LOCK(im->mutex);
|
||||
MUTEX_LOCK(&im->mutex);
|
||||
im->refcount++;
|
||||
MUTEX_UNLOCK(im->mutex);
|
||||
MUTEX_UNLOCK(&im->mutex);
|
||||
// Initialize primitive fields
|
||||
*array = (struct ArrowArray){// Data description
|
||||
.length = length,
|
||||
|
@ -208,9 +208,9 @@ export_fixed_pixel_array(Imaging im, struct ArrowArray *array) {
|
|||
length = im->xsize * im->lines_per_block;
|
||||
}
|
||||
|
||||
MUTEX_LOCK(im->mutex);
|
||||
MUTEX_LOCK(&im->mutex);
|
||||
im->refcount++;
|
||||
MUTEX_UNLOCK(im->mutex);
|
||||
MUTEX_UNLOCK(&im->mutex);
|
||||
// Initialize primitive fields
|
||||
// Fixed length arrays are 1 buffer of validity, and the length in pixels.
|
||||
// Data is in a child array.
|
||||
|
@ -246,9 +246,9 @@ export_fixed_pixel_array(Imaging im, struct ArrowArray *array) {
|
|||
goto err;
|
||||
}
|
||||
|
||||
MUTEX_LOCK(im->mutex);
|
||||
MUTEX_LOCK(&im->mutex);
|
||||
im->refcount++;
|
||||
MUTEX_UNLOCK(im->mutex);
|
||||
MUTEX_UNLOCK(&im->mutex);
|
||||
*array->children[0] = (struct ArrowArray){// Data description
|
||||
.length = length * 4,
|
||||
.offset = 0,
|
||||
|
|
|
@ -299,14 +299,14 @@ ImagingDelete(Imaging im) {
|
|||
return;
|
||||
}
|
||||
|
||||
MUTEX_LOCK(im->mutex);
|
||||
MUTEX_LOCK(&im->mutex);
|
||||
im->refcount--;
|
||||
|
||||
if (im->refcount > 0) {
|
||||
MUTEX_UNLOCK(im->mutex);
|
||||
MUTEX_UNLOCK(&im->mutex);
|
||||
return;
|
||||
}
|
||||
MUTEX_UNLOCK(im->mutex);
|
||||
MUTEX_UNLOCK(&im->mutex);
|
||||
|
||||
if (im->palette) {
|
||||
ImagingPaletteDelete(im->palette);
|
||||
|
|
Loading…
Reference in New Issue
Block a user