There are kinds of ways of summing up elements of a C++ vector sum up elements of vector, but how to guarantee the "atomically". What I means, during the summing action, the elements of the vector may be modified by other threads, which leads to unknown result. Is there a lock-free way to prevent vector being modified until the summation is complete.
Aucun commentaire:
Enregistrer un commentaire