Atomic variable Vs. Atomic operation
Hi,
Lets say I have two shared variables a,b which are related to each other. When multiple applications share these shared variables, access to them needs to be an atomic operation, otherwise the relation may break. So to ensure mutual exclusion, I'll put their modification under a critical section protected by lock. Code:
critical_code Code:
code Sincerely, Srinivas Nayak |
Quote:
|
well, if such a thing as atomic exists the two pieces of example code are still not equivalent
as you are doing two atomic operations not one. so if a and b are dependent as implied, then you still need a mutex. that's what I reckon anyway. |
All times are GMT -5. The time now is 10:37 PM. |