2011/10/3 Lev Serebryakov <[email protected]>: > Is here atomic increment and get (or add and get) operation in > kernel? I cannot find one. Here is atomic_add_32(), but it doesn't > return result. And here is no atomic_add_64() on 32 bit system :(
See atomic_fetchadd_int. Not all hardware has 64-bit atomic instructions available in 32-bit mode so it's not machine-independent. Generally, for this case (and potentially for sub-32-bit atomic operations [1]) a lock is used. [1] with masking and shifting 32-bit atomics can be used to set data in an 8 or 16 bit variable; see a recent commit to sys/vm. Cheers, matthew _______________________________________________ [email protected] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[email protected]"

