I need to abort a mnesia transaction for a certain time. I have tried everything and it doesn't work.
If I kill the process, some remote locks remain hung around though their pid is died.
func1(arguments ....) ->
erlang:timer(500, ParentPid, timeout),
mnesia:transaction( fun() ->
Rec = mnesia:read(tab1, key),
Rec1 = Rec#rec{value = NewVal},
mnesia:write(tab1, Rec1, write)
end).
Parentfunc(args ......) ->
Pid = self(),
RPid = spawn_link( fun() -> Res = check_funds_in_remote_site0(Part, Txid, Currency, Amount, Settcycle, Acc, Amount2, Pid, Timeout),
Pid ! {check_remote_funds_results0, Res} end),
receive
{check_remote_funds_results0, Result} ->
io:format("OK results : ~p~n",[Result]),
Result;
timeout -> mnesia:abort(timeout),
exit(RPid, kill),
.....
end.
Code unable to abort the transaction in functions func1.
how can it be implemented.
I have tried all possibilities but to no avail.