Boost logo

Boost :

From: William Kempf (sirwillard_at_[hidden])
Date: 2000-08-31 13:31:43

--- In boost_at_[hidden], "William Kempf" <sirwillard_at_m...> wrote:
> --- In boost_at_[hidden], "Jeff Paquette" <paquette_at_m...> wrote:

This discussion isn't really on topic, since the exchange() is the
only portable avenue open to us for reading/writing. So, if anyone
wants us to take this offline I'll do so.

> > mov eax, [b] ;;; pseudo x86 assembly - nits not wanted.
> > mov [a], eax

I've thought a bit more about this. So what if there's a task switch
between these two calls? I don't believe that Interlocked* commands
insure that there won't be a task switch, only that there won't be
any side effects caused by such a task switch. That's going to be
all that we can gaurantee in a portable library, any way.

If there were a task switch between these two calls the register
would be preserved. So the result in 'a' will be equivalent here,
which is all that you're trying to gaurantee any way. (Well,
actually, the InterlockedExchange must also insure that the return
value is consistent, but that's going beyond the claim made by the
Win32 documentation about basic read/write being atomic.)

Bill Kempf

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