John Baldwin <[EMAIL PROTECTED]> wrote:
>On 03-Oct-00 Jan Mikkelsen wrote:
>> There shouldn't be a need for a loop like the one you describe for a
simple
>> atomic increment.
>
>The trick is that I want to increment and read at the same time.
I don't know the exact semantics of atomic_cmpset_int, but it looks like a
compare and swap operation which returns zero if the operation failed, some
other value on success.
Unless I've missed something, the basic operation of your loop can be done
(on a '486 or better) without the loop by using the xadd instruction. Of
course, if the code needs to run on earlier processors, xadd fails and a
loop is necessary.
Jan Mikkelsen
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message