Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes, it is implemented by the hardware. In x86 I believe it is the CMPXCHG assembler instruction.

GCC, for example has __sync_val_compare_and_swap(...) function that give you access to the hardware compare and swap.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: