Re: __asm__ cmpxchg8b/cmpxchg16b
- From: Toby Douglass <a@xxxxx>
- Date: Wed, 2 Sep 2009 12:42:35 +0200
anthony.ajw@xxxxxxxxx wrote:
Toby Douglass <a@xxxxx> writes:
It does tell you reliably! It tells you exactly what the old value was
when the CAS executed. It does not tell you what the value is now (you'd
have to read it again to find out).
Yes - from one point of view, single threaded assembley, it tells you
reliably. The value is in the register and the correct value was placed
there, always.
From my point of view as a C programmer in a multi-threaded environment,it does not tell me reliably, because I cannot reliably get at that
information.
usingHowever, in other cases, where you're swapping pointers around,
the wrong value is not interesting in any way; it's fatal.
It depends what you do with the pointers. If you dereference them, and
don't have a means of ensuring that they are still valid then it's
fatal. If you're just using them for comparisons, or you do have a
lifetime-management scheme in place so they are safe for dereferencing
then it's fine.
Yes.
.
- Follow-Ups:
- Re: __asm__ cmpxchg8b/cmpxchg16b
- From: Zeljko Vrba
- Re: __asm__ cmpxchg8b/cmpxchg16b
- From: Anthony Williams
- Re: __asm__ cmpxchg8b/cmpxchg16b
- References:
- Re: __asm__ cmpxchg8b/cmpxchg16b
- From: Toby Douglass
- Re: __asm__ cmpxchg8b/cmpxchg16b
- From: Marcel Müller
- Re: __asm__ cmpxchg8b/cmpxchg16b
- From: Toby Douglass
- Re: __asm__ cmpxchg8b/cmpxchg16b
- From: Anthony Williams
- Re: __asm__ cmpxchg8b/cmpxchg16b
- From: Toby Douglass
- Re: __asm__ cmpxchg8b/cmpxchg16b
- From: Zeljko Vrba
- Re: __asm__ cmpxchg8b/cmpxchg16b
- From: Toby Douglass
- Re: __asm__ cmpxchg8b/cmpxchg16b
- From: Anthony Williams
- Re: __asm__ cmpxchg8b/cmpxchg16b
- From: Toby Douglass
- Re: __asm__ cmpxchg8b/cmpxchg16b
- From: Anthony Williams
- Re: __asm__ cmpxchg8b/cmpxchg16b
- Prev by Date: Re: __asm__ cmpxchg8b/cmpxchg16b
- Next by Date: Re: __asm__ cmpxchg8b/cmpxchg16b
- Previous by thread: Re: __asm__ cmpxchg8b/cmpxchg16b
- Next by thread: Re: __asm__ cmpxchg8b/cmpxchg16b
- Index(es):
Relevant Pages
|