if (tllp->t_current == TLL_READ) {
tllp->t_readonly++;
tllp->t_owner = NULL;
- }
+ } else if (tllp->t_current == TLL_WRITE)
+ assert(tllp->t_readonly == 0);
/* Due to the way upgrading and downgrading works, read-only requests are
* scheduled to run after a downgraded lock is released (because they are
else { /* Record owner if locktype is read-serialized or write-only */
tllp->t_owner = self;
}
+ if (tllp->t_current == TLL_WRITE)
+ assert(tllp->t_readonly == 0);
return(OK);
}
signal_owner = 1;
}
+ if (tllp->t_owner == self && tllp->t_current == TLL_WRITE)
+ assert(tllp->t_readonly == 0);
+
if(tllp->t_owner == self || (tllp->t_owner == NULL && tllp->t_readonly == 0)){
/* Let another read-serialized or write-only request obtain access.
* Write-only has priority, but only after the last read-only access