anchor.diff:  release_lock({Tid, Oid, Op}) ->
       if
   	Op == write ->
  -	    ?ets_delete(mnesia_held_locks, Oid);
  +	    ?ets_delete(mnesia_held_locks, {Oid, Tid});
   	Op == read ->
  -	    ets:delete_object(mnesia_held_locks, {Oid, Op, Tid})
  +	    ets:delete_object(mnesia_held_locks, {{Oid, Tid}, Op})
       end.
   
   rearrange_queue([{_Tid, {Tab, Key}, _} | Locks]) ->
  
positive.code: can_lock(Tid, read, {Tab, Key}, AlreadyQ) when Key /= ?ALL ->
      %% The key is bound, no need for the other BIF
      Oid = {Tab, Key},
      ObjLocks = ?ets_match_object(mnesia_held_locks, {Oid, write, '_'}),
      TabLocks = ?ets_match_object(mnesia_held_locks, {{Tab, ?ALL}, write, '_'}),
      check_lock(Tid, Oid, ObjLocks, TabLocks, yes, AlreadyQ, read);
  
  can_lock(Tid, read, Oid, AlreadyQ) -> % Whole tab
      Tab = element(1, Oid),
      ObjLocks = ?ets_match_object(mnesia_held_locks, {{Tab, '_'}, write, '_'}),
      check_lock(Tid, Oid, ObjLocks, [], yes, AlreadyQ, read);
  
  can_lock(Tid, write, {Tab, Key}, AlreadyQ) when Key /= ?ALL ->
      Oid = {Tab, Key},
      ObjLocks = ?ets_lookup(mnesia_held_locks, Oid),
      TabLocks = ?ets_lookup(mnesia_held_locks, {Tab, ?ALL}),
      check_lock(Tid, Oid, ObjLocks, TabLocks, yes, AlreadyQ, write);
  
  can_lock(Tid, write, Oid, AlreadyQ) -> % Whole tab
  
negative.code: 
  -record(queue, {oid, tid, op, pid, lucky}).
  
  %% mnesia_held_locks: contain       {{Oid,Tid}, Op} entries
  -define(match_oid_held_locks(Oid),  {{Oid, '_'}, '_'}).
  %% mnesia_tid_locks: contain        {Tid, Oid, Op} entries  (bag)
  -define(match_oid_tid_locks(Tid),   {Tid, '_', '_'}).
  %% mnesia_sticky_locks: contain     {Oid, Node} entries and {Tab, Node} entries (set)
  