Work around OTP-21 deprecation of get_stacktrace()
This commit is contained in:
parent
9eae901e58
commit
ad2d57d8b6
2 changed files with 32 additions and 14 deletions
|
@ -15,6 +15,7 @@
|
||||||
{platform_define, "^1[8|9]", rand_module},
|
{platform_define, "^1[8|9]", rand_module},
|
||||||
{platform_define, "^2", rand_module},
|
{platform_define, "^2", rand_module},
|
||||||
{platform_define, "^2", unicode_str},
|
{platform_define, "^2", unicode_str},
|
||||||
|
{platform_define, "^(R|1|20)", fun_stacktrace},
|
||||||
debug_info,
|
debug_info,
|
||||||
warnings_as_errors]}.
|
warnings_as_errors]}.
|
||||||
|
|
||||||
|
|
|
@ -822,20 +822,7 @@ cluster_runmany(Fun, Fuse, [Task|TaskList], [N|Nodes], Running, Results) ->
|
||||||
Parent ! {erlang:self(), fuse, FuseFunc(R1, R2)}
|
Parent ! {erlang:self(), fuse, FuseFunc(R1, R2)}
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
Fun3 = fun () ->
|
Fun3 = fun() -> runmany_wrap(Fun2, Parent) end,
|
||||||
try
|
|
||||||
Fun2()
|
|
||||||
catch
|
|
||||||
exit:siblingdied ->
|
|
||||||
ok;
|
|
||||||
exit:Reason ->
|
|
||||||
Parent ! {erlang:self(), error, Reason};
|
|
||||||
error:R ->
|
|
||||||
Parent ! {erlang:self(), error, {R, erlang:get_stacktrace()}};
|
|
||||||
throw:R ->
|
|
||||||
Parent ! {erlang:self(), error, {{nocatch, R}, erlang:get_stacktrace()}}
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
Pid = proc_lib:spawn(N, Fun3),
|
Pid = proc_lib:spawn(N, Fun3),
|
||||||
erlang:monitor(process, Pid),
|
erlang:monitor(process, Pid),
|
||||||
cluster_runmany(Fun, Fuse, TaskList, Nodes, [{Pid, N, Task}|Running], Results);
|
cluster_runmany(Fun, Fuse, TaskList, Nodes, [{Pid, N, Task}|Running], Results);
|
||||||
|
@ -885,6 +872,36 @@ cluster_runmany(_, _, [_Non|_Empty], []=_Nodes, []=_Running, _) ->
|
||||||
%% We have data, but no nodes either available or occupied
|
%% We have data, but no nodes either available or occupied
|
||||||
erlang:exit(allnodescrashed).
|
erlang:exit(allnodescrashed).
|
||||||
|
|
||||||
|
-ifdef(fun_stacktrace).
|
||||||
|
runmany_wrap(Fun, Parent) ->
|
||||||
|
try
|
||||||
|
Fun
|
||||||
|
catch
|
||||||
|
exit:siblingdied ->
|
||||||
|
ok;
|
||||||
|
exit:Reason ->
|
||||||
|
Parent ! {erlang:self(), error, Reason};
|
||||||
|
error:R ->
|
||||||
|
Parent ! {erlang:self(), error, {R, erlang:get_stacktrace()}};
|
||||||
|
throw:R ->
|
||||||
|
Parent ! {erlang:self(), error, {{nocatch, R}, erlang:get_stacktrace()}}
|
||||||
|
end.
|
||||||
|
-else.
|
||||||
|
runmany_wrap(Fun, Parent) ->
|
||||||
|
try
|
||||||
|
Fun
|
||||||
|
catch
|
||||||
|
exit:siblingdied ->
|
||||||
|
ok;
|
||||||
|
exit:Reason ->
|
||||||
|
Parent ! {erlang:self(), error, Reason};
|
||||||
|
error:R:Stacktrace ->
|
||||||
|
Parent ! {erlang:self(), error, {R, Stacktrace}};
|
||||||
|
throw:R:Stacktrace ->
|
||||||
|
Parent ! {erlang:self(), error, {{nocatch, R}, Stacktrace}}
|
||||||
|
end.
|
||||||
|
-endif.
|
||||||
|
|
||||||
delete_running(Pid, [{Pid, Node, List}|Running], Acc) ->
|
delete_running(Pid, [{Pid, Node, List}|Running], Acc) ->
|
||||||
{Running ++ Acc, Node, List};
|
{Running ++ Acc, Node, List};
|
||||||
delete_running(Pid, [R|Running], Acc) ->
|
delete_running(Pid, [R|Running], Acc) ->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue