Runing Photofilmstrip from the command line on a machine with 12 CPUs, I came across this problem. The method:
def IncDoneCount(self):
self.__doneCount += 1
in JobManager.py is not thread safe. As a result, sometimes two threads call the method but only one increment occurs. That leaves the command line hanging, waiting for all threads ot finish. They have, it's just the count is off by one.
Hi Peter,
thanks a lot for investigating this issue. Actually i experienced your reported problem sometimes but never suspected this method. Now i know incrementing a value is not an atomic operation.
Thanks again.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Runing Photofilmstrip from the command line on a machine with 12 CPUs, I came across this problem. The method:
in JobManager.py is not thread safe. As a result, sometimes two threads call the method but only one increment occurs. That leaves the command line hanging, waiting for all threads ot finish. They have, it's just the count is off by one.
I added:
from this SO post with an appropriate lock variable defined in the class, which seems to have fixed the problem.
Hi Peter,
thanks a lot for investigating this issue. Actually i experienced your reported problem sometimes but never suspected this method. Now i know incrementing a value is not an atomic operation.
Thanks again.