aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2013-11-28 15:10:35 +0100
committerRickard Green <[email protected]>2013-11-28 15:10:35 +0100
commit23a30d882464df4210ea53096ea50e7b44876812 (patch)
treeefbc5e97dc55e63b6e194921007f88e651960764 /erts/preloaded
parent8bc2bac6b60724c2b454bf572ab13146a7154b2f (diff)
parent9f998969014095333545cb118467e1ff8d450c31 (diff)
downloadotp-23a30d882464df4210ea53096ea50e7b44876812.tar.gz
otp-23a30d882464df4210ea53096ea50e7b44876812.tar.bz2
otp-23a30d882464df4210ea53096ea50e7b44876812.zip
Merge branch 'maint'
* maint: Fix prim_inet:close/1 Ensure exit signal due to link precede port BIF return Conflicts: erts/preloaded/ebin/prim_inet.beam
Diffstat (limited to 'erts/preloaded')
-rw-r--r--erts/preloaded/ebin/prim_inet.beambin73252 -> 72932 bytes
-rw-r--r--erts/preloaded/src/prim_inet.erl28
2 files changed, 2 insertions, 26 deletions
diff --git a/erts/preloaded/ebin/prim_inet.beam b/erts/preloaded/ebin/prim_inet.beam
index 3870e41e67..aa0371e6b2 100644
--- a/erts/preloaded/ebin/prim_inet.beam
+++ b/erts/preloaded/ebin/prim_inet.beam
Binary files differ
diff --git a/erts/preloaded/src/prim_inet.erl b/erts/preloaded/src/prim_inet.erl
index 430313a459..143c718130 100644
--- a/erts/preloaded/src/prim_inet.erl
+++ b/erts/preloaded/src/prim_inet.erl
@@ -186,32 +186,8 @@ close_pend_loop(S, N) ->
end.
close_port(S) ->
- case erlang:process_info(self(), trap_exit) of
- {trap_exit,true} ->
- %% Ensure exit message and consume it
- link(S),
- %% This is still not a perfect solution.
- %%
- %% The problem is to close the port and consume any exit
- %% message while not knowing if this process traps exit
- %% nor if this process has a link to the port. Here we
- %% just knows that this process traps exit.
- %%
- %% If we right here get killed for some reason that exit
- %% signal will propagate to the port and onwards to anyone
- %% that is linked to the port. E.g when we close a socket
- %% that is not ours.
- %%
- %% The problem can be solved with lists:member on our link
- %% list but we deem that as potentially too expensive. We
- %% need an is_linked/1 function or guard, or we need
- %% a port_close function that can atomically unlink...
- catch erlang:port_close(S),
- receive {'EXIT',S,_} -> ok end;
- {trap_exit,false} ->
- catch erlang:port_close(S),
- ok
- end.
+ catch erlang:port_close(S),
+ receive {'EXIT',S,_} -> ok after 0 -> ok end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%