NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: atomic_ops vs mutex

On Nov,Saturday 7 2009, at 4:21 AM, wrote:

The following is from the atomic_ops(3) man page:

Because atomic memory operations require expensive
synchronization at the hardware level, applications should take care to
minimize their use.  In certain cases, it may be more appropriate to
use a mutex, especially if more than one memory location will be

I have two questions:

1. Are all atomic_ops functions, or some of them macros?

2. In what cases would it be better to use atomic_ops, instead of
locking and unlocking mutex?

I think that in case when you want to use atomic_ops for 3-4 memory locations you should use mutex.



Home | Main Index | Thread Index | Old Index