Commit bad25b63 authored by David E. DeMarle's avatar David E. DeMarle

work around a bug where multiple threads delete image together

The test hits a corner case that we don't care about much -
many threads writing the same image. In the interests of time I'm
simply using a deepcopy per thread but only in the test for now.
At some point we should actually prevent the threads from calling
Delete simultaneously and do so without a copy.
parent 432cf970
......@@ -39,7 +39,15 @@ for i in range(10):
for fileName in fileNames:
filePath = '%s/%s-%s' % (VTK_TEMP_DIR, i, fileName)
writer.EncodeAndWrite(image, filePath)
# making a deepcopy only because we have the same image
# shared among all threads in this test, and that causes
# problems when many threads Delete it at the same time.
# TODO: rework writer to manage pointer better to address
# this corner case better while not resorting to any copy.
icopy = vtk.vtkImageData()
writer.EncodeAndWrite(icopy, filePath)
t1 = time.time()
# Try to put the print outside the write loop
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment