Boost logo

Boost :

From: Bill Wade (bill.wade_at_[hidden])
Date: 2000-08-31 11:04:52


> From: William Kempf [mailto:sirwillard_at_[hidden]]

> The counter is used for much more than just ref-counting.

In general your statement is true.

For my COW String the counter is used only for ref counting and to flag
unshareable.

> I see no InterlockedRead.

From developer studio help (this might be from later MSDN stuff). The
article is titled "Interlocked Variable Access" and on my machine has a URL
of

mk:@MSITStore:M:\Disk02\MSDN\dllproc.chm::/devdoc/live/winbase/synchro_925v.
htm

"The interlocked functions provide a simple mechanism for synchronizing
access to a variable that is shared by multiple threads. The threads of
different processes can use this mechanism if the variable is in shared
memory. Note that SIMPLE READS and WRITES to properly-aligned 32-bit
variables are ATOMIC. The interlocked functions should be used to perform
complex operations in an atomic manner."

Emphasis added. The first time I noticed this I had SP3. I looked on a
machine with SP1 and could not find this entry.

>I'm not referring to
> InterlockedExchangeAdd, but to InterlockedExchange.

I'm not sure I know how to do a safe read with just InterlockedExchange.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk