Merge pull request #11568 from rgroothuijsen/OL-11178
Fix raster source crash bug when using multiple threads
This commit is contained in:
@@ -283,7 +283,7 @@ export class Processor extends Disposable {
|
|||||||
const offset = i * segmentLength;
|
const offset = i * segmentLength;
|
||||||
const slices = [];
|
const slices = [];
|
||||||
for (let j = 0, jj = buffers.length; j < jj; ++j) {
|
for (let j = 0, jj = buffers.length; j < jj; ++j) {
|
||||||
slices.push(buffers[i].slice(offset, offset + segmentLength));
|
slices.push(buffers[j].slice(offset, offset + segmentLength));
|
||||||
}
|
}
|
||||||
this._workers[i].postMessage(
|
this._workers[i].postMessage(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -594,6 +594,23 @@ where('Uint8ClampedArray').describe('Processor', function () {
|
|||||||
done();
|
done();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('can run on multiple threads', function (done) {
|
||||||
|
const processor = new Processor({
|
||||||
|
threads: 2,
|
||||||
|
operation: identity,
|
||||||
|
});
|
||||||
|
|
||||||
|
const input = newImageData(new Uint8ClampedArray([1, 2, 3, 4]), 1, 1);
|
||||||
|
processor.process([input], {}, function (err) {
|
||||||
|
if (err) {
|
||||||
|
done(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
processor.dispose();
|
||||||
|
setTimeout(done, 20);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#process() - faux worker', function () {
|
describe('#process() - faux worker', function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user