anchor.diff:  release_lock({Tid, Oid, {queued, _}}) ->
       ?ets_match_delete(mnesia_lock_queue, #queue{oid=Oid, tid = Tid, op = '_',
   						pid = '_', lucky = '_'});
  -release_lock({This, Oid, Op}) ->
  +release_lock({Tid, Oid, Op}) ->
       case ?ets_lookup(mnesia_held_locks, Oid) of
   	[] -> ok;
   	[{Oid, Prev, Locks0}] ->
  -	    Locks = [{TOp, Tid} || {TOp, Tid} <- Locks0, Tid =/= This],
  +	    Locks = remove_tid(Locks0, Tid, []),
   	    if Locks =:= [] ->
   		    ?ets_delete(mnesia_held_locks, Oid);
   	       Op =:= read ->
  
positive.code: 	    loop(State)
      end.
  
  set_lock(Tid, Oid, Op) ->
      ?dbg("Granted ~p ~p ~p~n", [Tid,Oid,Op]),
      case ?ets_lookup(mnesia_held_locks, Oid) of
  	[] ->
  	    ?ets_insert(mnesia_held_locks, {Oid, Op, [{Op, Tid}]});
  	[{Oid, Prev, Items}] when Op == read ->
  	    ?ets_insert(mnesia_held_locks, {Oid, Prev, [{Op, Tid}|Items]});
  	[{Oid, _, Items}] when Op == write ->
  	    ?ets_insert(mnesia_held_locks, {Oid, Op, [{Op, Tid}|Items]})
      end,
      ?ets_insert(mnesia_tid_locks, {Tid, Oid, Op}).
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%
  %% Acquire locks
  
negative.code:     Op = {ix_read,IxKey, Pos},
      Lock = read,
      case can_lock(Tid, Lock, Oid, {no, bad_luck}) of
  	{yes, Default} ->
  	    Reply = grant_lock(Tid, Op, Lock, Oid, Default),
  	    reply(From, Reply);
  	{{no, Lucky},_} ->
  	    C = #cyclic{op = Op, lock = Lock, oid = Oid, lucky = Lucky},
  	    ?dbg("Rejected ~p ~p ~p ~p ~n", [Tid, Oid, Lock, Lucky]),
  	    reply(From, {not_granted, C});
  	{{queue, Lucky},_} ->
  	    ?dbg("Queued ~p ~p ~p ~p ~n", [Tid, Oid, Lock, Lucky]),
  	    %% Append to queue: Nice place for trace output
  	    ?ets_insert(mnesia_lock_queue,
  