|
Question about CAS (compare and swap) method
CAS method can fail because of 2 reasons:
1. - the operation was failed because of other thread.
2. - the comparison was failed.
The question is: how I know the reason of failure? Because in first case I probably whould like to retry operation in loop until it succeeded, but in second case loop will be infinite.
Thanks.
|