Re: cmpxchgl on x86?
Re: cmpxchgl on x86?
- Subject: Re: cmpxchgl on x86?
- From: David Leimbach <email@hidden>
- Date: Fri, 24 Jun 2005 07:54:59 -0700
On 6/24/05, David Leimbach <email@hidden> wrote:
> On 6/24/05, Jonas Maebe <email@hidden> wrote:
> >
> > On 24 jun 2005, at 16:40, David Leimbach wrote:
> >
> > >> Also, there are compare-and-swap routines already in libSystem:
> > >>
> > >> <libkern/OSAtomic.h>
> > >>
> > >> /* Compare and swap. They return true if the swap occured.
> > >> */
> > >> bool OSAtomicCompareAndSwap32( int32_t oldValue, int32_t newValue,
> > >> int32_t *theValue );
> > >> bool OSAtomicCompareAndSwap32Barrier( int32_t oldValue, int32_t
> > >> newValue, int32_t *theValue );
> > >
> > > Seems a shame to have to include an entire other framework just for a
> > > single assembly instruction :). It'd be really cool if apple had a
> > > lighter weight wrapper around such lock code :).
> >
> > libSystem = libc
>
> Note he wants me to use libkern. Which is it? :)
Also projects like mach_override include an entire other framework to
access that header. It's still too much. It doesn't much matter
which library where the binary resides if I have to add another
dependency.
Way easier is to read the kernel source and figure it out than to call
the above routines. [in my opinion].
NetBSD has a nice repository of lock instructions as well.
Dave
>
> >
> >
> > Jonas
> >
> > _______________________________________________
> > Do not post admin requests to the list. They will be ignored.
> > Darwin-dev mailing list (email@hidden)
> > Help/Unsubscribe/Update your Subscription:
> >
> > This email sent to email@hidden
> >
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden