diff options
author | Frans Kaashoek <kaashoek@mit.edu> | 2016-09-08 21:20:26 -0400 |
---|---|---|
committer | Frans Kaashoek <kaashoek@mit.edu> | 2016-09-08 21:20:26 -0400 |
commit | 551c2f3576d34e4749a1165af07d90e21ad528be (patch) | |
tree | 7fac220585c88fcb568bc8c656e0532b033fec9b /spinlock.c | |
parent | 1b8ccf9482facb15f905a6baca4f5d800a13c542 (diff) | |
parent | 34c2efc1d063f4b366c1017c174d117cc96eb990 (diff) | |
download | xv6-labs-551c2f3576d34e4749a1165af07d90e21ad528be.tar.gz xv6-labs-551c2f3576d34e4749a1165af07d90e21ad528be.tar.bz2 xv6-labs-551c2f3576d34e4749a1165af07d90e21ad528be.zip |
Merge branch 'master' of g.csail.mit.edu:xv6-dev
Diffstat (limited to 'spinlock.c')
-rw-r--r-- | spinlock.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -59,8 +59,10 @@ release(struct spinlock *lk) // stores; __sync_synchronize() tells them both to not re-order. __sync_synchronize(); - // Release the lock. - lk->locked = 0; + // Release the lock, equivalent to lk->locked = 0. + // This code can't use a C assignment, since it might + // not be atomic. + asm volatile("movl $0, %0" : "+m" (lk->locked) : ); popcli(); } |