Boost logo

Boost :

From: Mattias Flodin (flodin_at_[hidden])
Date: 2001-11-17 11:53:05

On Sat, 17 Nov 2001, Carl Daniel wrote:
> It's probably be worth noting that InterlockedIncrement/decrement on NT 3.5.1 and Windows 95 does not necessarily return
> the new count. It returns 0 if the the result was 0, a negative number if the count was negative, a positive number if
> the count was positive.

Right. If worse comes to worse, it is possible to get around this by
implementing those functions in inline assembler, using the lock prefix on
the IA-32 inc instruction (something similar exists for Alpha processors,
and IA-64 is not an issue since there are no pre-Windows XP
implementations for it). But as long as this is a detail class it is
undoubtedly better to just have the counter provide the least common
denominator of the platforms instead. That is, something like an
increment() and a decrement() function that provide the same return value
semantics as the Interlocked* functions on pre-NT4 platforms.

Mattias Flodin <flodin_at_[hidden]>   "A good thing about C++ is that only
Room D418                           friends can access your private parts"
Department of Computing Science
Umeå University
S-901 87 Umeå, Sweden
Note: Any opinions expressed in this mail are personal, and do not
necessarily reflect an official standpoint of Umeå University.

Boost list run by bdawes at, gregod at, cpdaniel at, john at