void
unlock(Lock *l)
{
if(l->key == 0)
print("unlock: not locked: pc %luX\n", getcallerpc(&l));
if(l->isilock)
print("unlock of ilock: pc %lux, held by %lux\n", getcallerpc(&l), l->pc);
if(l->p != up)
print("unlock: up changed: pc %lux, acquired at pc %lux, lock p 0x%p, unlock up 0x%p\n", getcallerpc(&l), l->pc, l->p, up);
l->key = 0;
coherence();
if(up)
--up->nlocks;
}
void
iunlock(Lock *l)
{
ulong sr;
if(l->key == 0)
print("iunlock: not locked: pc %luX\n", getcallerpc(&l));
if(!l->isilock)
print("iunlock of lock: pc %lux, held by %lux\n", getcallerpc(&l), l->pc);
if(islo())
print("iunlock while lo: pc %lux, held by %lux\n", getcallerpc(&l), l->pc);