On 2001-Feb-08 18:21:07 +0100, Bernd Walter <[EMAIL PROTECTED]> wrote:
>Are atomic_* implementations allowed to spin/sleep?

The atomic_* operations are the primitives used to build all the
higher level locking functions.  Therefore you are not allowed to
sleep.

As for spinning: You can't implement them using a `normal' spinlock.
Some architectures, eg the Alpha, don't have RMW primitives.  The
Alpha has load-locked and store-conditional instructions which let you
build atomic operations - you need to spin between the load and store
if the store fails.  The store will only fail if you took an interrupt
between the load and store or if another master updated the location
between your load and store.  Look into /sys/alpha/alpha/atomic.s for
code.

>The only way to implement them on these platforms is to use a lock.

Except that locks are built using the atomic_* functions.

Peter


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to