Assume we have a parallel multi instance script task that does somethig like:
- do stuff
- read variable x
- modify x
- update x
So x could be a counter, then we would get x = 5, do x = x + 7 (e.g. number of changes done) and save x.
Is there any way to make the code from reading to updating of the variable atomic? Alternatively if we could lock and release the variable this would work too (similar to fetch and lock for external tasks). But I haven’t found any information about this.
Why is it important? Because the task is executed in prallel it is possible that two task instances read the variable before the other task updated it and then the update of one of the tasks is getting lost.