concurrent writing


I have a question about concurrent writing. One problem with concurrent writing if I understood the concept, is when some thread i want to set a data A = 4 and another thread j want to set the data A = 10, we don’t know the value of A.

But, the value of A could only be 10 or 4 ? (if only the thread i and j use this data possibly concurrently). Because for my problem, it is not a problem to know if A = 4 or A = 10, but it must be A = 10 or 4

Yes, in the scenario you describe, A will be either 10 or 4, nothing else.

ok thanks. So it is solve