From 19b03965fe70ceb1c4b4a29c2f0e0ef2330763d1 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 26 Oct 2023 09:54:58 +0200 Subject: [PATCH] [kernel|esock] Changed select and completion tag types Make the select and completion tag types more expressive. OTP-18818 --- lib/kernel/doc/src/socket.xml | 5 +++-- lib/kernel/src/socket.erl | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/kernel/doc/src/socket.xml b/lib/kernel/doc/src/socket.xml index 9aabdfce2c09..6dc84a2adb72 100644 --- a/lib/kernel/doc/src/socket.xml +++ b/lib/kernel/doc/src/socket.xml @@ -239,7 +239,7 @@

- A tag that describes the (select) operation, + A tag that describes the (select) operation (= function name), contained in the returned select_info().

@@ -272,7 +272,8 @@

- A tag that describes the ongoing (completion) operation, + A tag that describes the ongoing (completion) operation + (= function name), contained in the returned completion_info().

diff --git a/lib/kernel/src/socket.erl b/lib/kernel/src/socket.erl index 16defc349146..68e79e599c34 100644 --- a/lib/kernel/src/socket.erl +++ b/lib/kernel/src/socket.erl @@ -793,8 +793,21 @@ %% Interface term formats %% --opaque select_tag() :: atom() | {atom(), ContData :: term()}. --opaque completion_tag() :: atom(). % | {atom(), ContData :: term()}. +-define(ASYNCH_DATA_TAG, (recv | recvfrom | recvmsg | + send | sendto | sendmsg)). +-define(ASYNCH_TAG, ((accept | connect) | ?ASYNCH_DATA_TAG)). + +%% -type asynch_data_tag() :: send | sendto | sendmsg | +%% recv | recvfrom | recvmsg | +%% sendfile. +%% -type asynch_tag() :: connect | accept | +%% asynch_data_tag(). +%% -type select_tag() :: asynch_tag() | +%% {asynch_data_tag(), ContData :: term()}. +%% -type completion_tag() :: asynch_tag(). +-type select_tag() :: ?ASYNCH_TAG | sendfile | + {?ASYNCH_DATA_TAG | sendfile, ContData :: term()}. +-type completion_tag() :: ?ASYNCH_TAG. -type select_handle() :: reference(). -type completion_handle() :: reference().