diff options
author | Micael Karlberg <[email protected]> | 2019-04-16 13:43:45 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2019-05-29 14:22:47 +0200 |
commit | 1039d05f393d470a1edba93a0026f4fba7d2ce5b (patch) | |
tree | dc6182cf7911aa20a667309a75ea968a3a8f77be /erts/preloaded | |
parent | e95430644d7f9144a632b89370222c3b7119dc33 (diff) | |
download | otp-1039d05f393d470a1edba93a0026f4fba7d2ce5b.tar.gz otp-1039d05f393d470a1edba93a0026f4fba7d2ce5b.tar.bz2 otp-1039d05f393d470a1edba93a0026f4fba7d2ce5b.zip |
[socket] Add cancel and the first recvfrom(nowait) cancel test case
Add the (public) cancel function and the first of
the cancel test cases (recvfrom(nowait)).
Diffstat (limited to 'erts/preloaded')
-rw-r--r-- | erts/preloaded/ebin/socket.beam | bin | 74380 -> 74584 bytes | |||
-rw-r--r-- | erts/preloaded/src/socket.erl | 23 |
2 files changed, 22 insertions, 1 deletions
diff --git a/erts/preloaded/ebin/socket.beam b/erts/preloaded/ebin/socket.beam Binary files differindex 98adde8ae5..b8983eb8e8 100644 --- a/erts/preloaded/ebin/socket.beam +++ b/erts/preloaded/ebin/socket.beam diff --git a/erts/preloaded/src/socket.erl b/erts/preloaded/src/socket.erl index c805c5586d..f4d8f175f8 100644 --- a/erts/preloaded/src/socket.erl +++ b/erts/preloaded/src/socket.erl @@ -53,7 +53,9 @@ getopt/3, sockname/1, - peername/1 + peername/1, + + cancel/2 ]). -export_type([ @@ -2586,6 +2588,25 @@ peername(#socket{ref = SockRef}) -> nif_peername(SockRef). +%% =========================================================================== +%% +%% cancel - cancel an operation resulting in a select +%% +%% A call to accept, recv/recvfrom/recvmsg and send/sendto/sendmsg +%% can result in a select if they are called with the Timeout argument +%% set to nowait. This is indicated by the return of the select-info. +%% Such a operation can be cancelled by calling this function. +%% + +-spec cancel(Socket, SelectInfo) -> ok | {error, Reason} when + Socket :: socket(), + SelectInfo :: select_info(), + Reason :: term(). + +cancel(#socket{ref = SockRef}, {select, Tag, Ref}) -> + cancel(SockRef, Tag, Ref). + + %% =========================================================================== %% |