Lock-Free

Lock-Free

A "wait-free" procedure can complete in a finite number of steps, regardless of the relative speeds of other threads.

A "lock-free" procedure guarantees progress of at least one of the threads executing the procedure. That means some threads can be delayed arbitrarily, but it is guaranteed that at least one thread makes progress at each step.

CAS:assuming the map hasn't changed since I last looked at it, copy it. Otherwise, start all over again.

Delay Update:In plain English, the loop says "I'll replace the old map with a new, updated one, and I'll be on the lookout for any other updates of the map, but I'll only do the replacement when the reference count of the existing map is one."  


[REF] http://www.drdobbs.com/cpp/184401865

你可能感兴趣的:(Lock-Free)