Your revised version has the disadvantage of not working.
Consider a lock word that's initially 1:

Task 1:         Task 2:         
                
cmpb $0,%0      cmpb $0,%0      Both see it as equal to 1
jle 2f          jle 2f          Both no NOT jump
movb $0, %0     movb $0, %0     Both overwrite it with zero.

When releasing a lock, there is no race condition because only one
task *has* the lock.  But when acquiring it, you need the (expensive0
atomic test-and-set to synchronize between different processors.
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to