
8 Jul
2004
8 Jul
'04
8:36 a.m.
Dan wrote:
Also one does not need to use a spin lock on a ref counted implementation. A much faster (and safer) way to do that is just using InterlockedIncrement and InterlockedDecrement when changing the ref count. I beleive this is what most popular ref counting implementations use.
If you're referring to the ref-counted shared_ptr, then it has two counts it needs to keep track of, strong_count and weak_count, so InterlockedXXXXXX can't be used. Therefore the 'spin-lock' was introduced IIUC. Cheers Russell