Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Oct 2000 10:59:56 +0200
From:      Poul-Henning Kamp <phk@critter.freebsd.dk>
To:        "Jan Mikkelsen" <janm@transactionsite.com>
Cc:        "John Baldwin" <jhb@FreeBSD.ORG>, "Kevin Mills" <kmills@aventail.com>, "FreeBSD Hackers" <freebsd-hackers@FreeBSD.ORG>
Subject:   Re: atomic operations 
Message-ID:  <46868.970563596@critter>
In-Reply-To: Your message of "Tue, 03 Oct 2000 19:51:16 %2B1100." <005801c02d17$17efc0a0$0901a8c0@haym.transactionsite.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <005801c02d17$17efc0a0$0901a8c0@haym.transactionsite.com>, "Jan Mikk
elsen" writes:
>John Baldwin <jhb@FreeBSD.org> 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.

That is exactly what atomic_cmpset_int is for, look in 
	sys/fs/devfs/devfs_devs.c
for some examples

--
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD coreteam member | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?46868.970563596>