anchor.diff:  		    {not_granted, C}
   	    end
       end;
  -grant_lock(Tid, {ix_read,IxKey,Pos}, Lock, Oid = {Tab, _}) ->
  +grant_lock(Tid, {ix_read,IxKey,Pos}, Lock, Oid = {Tab, _}, Default) ->
       try
   	Res = ix_read_res(Tab, IxKey,Pos),
  -	set_lock(Tid, Oid, Lock),
  +	set_lock(Tid, Oid, Lock, Default),
   	{granted, Res, [?ALL]}
       catch _:_ ->
   	    {not_granted, {no_exists, Tab, {index, [Pos]}}}
       end;
  -grant_lock(Tid, read, Lock, Oid) ->
  -    set_lock(Tid, Oid, Lock),
  +grant_lock(Tid, read, Lock, Oid, Default) ->
  +    set_lock(Tid, Oid, Lock, Default),
       {granted, ok};
  -grant_lock(Tid, write, Lock, Oid) ->
  -    set_lock(Tid, Oid, Lock),
  +grant_lock(Tid, write, Lock, Oid, Default) ->
  +    set_lock(Tid, Oid, Lock, Default),
       granted.
   
   %% 1) Impose an ordering on all transactions favour old (low tid) transactions
  
positive.code: 
  try_lock(Tid, Op, SimpleOp, Lock, Pid, Oid) ->
      case can_lock(Tid, Lock, Oid, {no, bad_luck}) of
  	yes ->
  	    Reply = grant_lock(Tid, SimpleOp, Lock, Oid),
  	    reply(Pid, Reply);
  	{no, Lucky} ->
  	    C = #cyclic{op = SimpleOp, lock = Lock, oid = Oid, lucky = Lucky},
  	    ?dbg("Rejected ~p ~p ~p ~p ~n", [Tid, Oid, Lock, Lucky]),
  	    reply(Pid, {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,
  
negative.code: 
  try_waiter(Oid, Op, SimpleOp, Lock, ReplyTo, Tid) ->
      case can_lock(Tid, Lock, Oid, {queue, bad_luck}) of
  	{yes, Default} ->
  	    %% Delete from queue: Nice place for trace output
  	    ?ets_match_delete(mnesia_lock_queue,
  			      #queue{oid=Oid, tid = Tid, op = Op,
  				     pid = ReplyTo, lucky = '_'}),
  	    Reply = grant_lock(Tid, SimpleOp, Lock, Oid, Default),
  	    reply(ReplyTo,Reply),
  	    locked;
  	{{queue, _Why}, _} ->
  	    ?dbg("Keep ~p ~p ~p ~p~n", [Tid, Oid, Lock, _Why]),
  	    queued; % Keep waiter in queue
  	{{no, Lucky}, _} ->
  	    C = #cyclic{op = SimpleOp, lock = Lock, oid = Oid, lucky = Lucky},
  	    verbose("** WARNING ** Restarted transaction, possible deadlock in lock queue ~w: cyclic = ~w~n",
  		    [Tid, C]),
  