Previous | Next --- Slide 24 of 44
Back to Lecture Thumbnails
albusshin

My scratch implementation of compare_and_swap using lock cmpxchg:

compare_and_swap:
    ld eax, a
    lock cmpxchg x, b
    bnz return_true
    ld eax, $0
    ret
return_true:
    ld eax, $1
    ret