PATCH: Generic function descriptor
Carlos O'Donell
carlos@baldric.uwo.ca
Fri Apr 4 21:25:00 GMT 2003
> #ifndef COMPARE_AND_SWAP
> #define COMPARE_AND_SWAP(ptr,old,new) \
> atomic_compare_and_exchange_bool_acq ((ptr), (old), (new))
> #endif
I've looked at various implementations of this for HPPA (atomicity.h),
and the only truly atomic way is through a light-weight syscall (same
way we set our thread pointer in INIT_THREAD_SELF). Though I should
probably think about this more since it really not optimal. Any
recommendations are more than welcome.
Lockfree Queue Algorithm using singly-linked lists:
http://www.cs.rpi.edu/pub/valoisj/tr94-17.ps.gz
Describes a method for insert/delete from a table using CAS as you
outline here.
For those with ACM access...
High performance dynamic lock-free hash tables and list-based sets:
http://doi.acm.org/10.1145/564870.564881
c.
More information about the Libc-alpha
mailing list