From e4224651bf0b560435380ad327522dd8a0e74db6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 7 Apr 2020 15:19:52 +0300 Subject: [PATCH] net: Add NET_WAIT_FOREVER symbol to be used as timeout in network APIs If a network API expects a millisecond timeout, then NET_WAIT_FOREVER symbol can be used to indicate that the timeout should last forever. Signed-off-by: Jukka Rissanen --- include/net/net_core.h | 2 ++ include/net/net_timeout.h | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/include/net/net_core.h b/include/net/net_core.h index 782499136a0..cc19d80535e 100644 --- a/include/net/net_core.h +++ b/include/net/net_core.h @@ -20,6 +20,8 @@ #include #include +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/include/net/net_timeout.h b/include/net/net_timeout.h index 2cbc2934270..4ef08f5ebd5 100644 --- a/include/net/net_timeout.h +++ b/include/net/net_timeout.h @@ -28,6 +28,12 @@ extern "C" { #endif +/** + * Symbol to indicate that the caller wants the timeout to be waited forever. + * This can be used when a network API expects a millisecond timeout. + */ +#define NET_WAIT_FOREVER (-1) + /** Let the max timeout be 100 ms lower because of * possible rounding in delayed work implementation. */