From 66f87d5b591a87d9e5c990a9e3e50a5f70adf634 Mon Sep 17 00:00:00 2001 From: Jonathan Bohren Date: Tue, 10 Aug 2021 21:12:12 -0400 Subject: [PATCH 1/2] Adding note on SB undefined behavior with SB_PEND_FOREVER and CFE_SB_DeletePipe() See discussion in https://github.com/nasa/cFE/pull/1777 --- modules/core_api/fsw/inc/cfe_sb.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/core_api/fsw/inc/cfe_sb.h b/modules/core_api/fsw/inc/cfe_sb.h index 92f83c82c..5b03cbe99 100644 --- a/modules/core_api/fsw/inc/cfe_sb.h +++ b/modules/core_api/fsw/inc/cfe_sb.h @@ -99,6 +99,11 @@ CFE_Status_t CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const c ** associated with the pipe. All subscriptions made for this pipe by ** calls to #CFE_SB_Subscribe will be automatically removed from the ** SB routing tables. Any messages in the pipe will be discarded. +** +** If this routine is called from one task while execution of another +** task is blocked by a call to CFE_SB_ReceiveBuffer() with TimeOut +** #CFE_SB_PEND_FOREVER, there is no guarantee that +** CFE_SB_ReceiveBuffer() will return. ** ** Applications should not call this routine for all of their ** SB pipes as part of their orderly shutdown process, as the @@ -434,6 +439,10 @@ CFE_Status_t CFE_SB_TransmitMsg(CFE_MSG_Message_t *MsgPtr, bool IncrementSequenc ** If the pipe is empty, this routine will block until either a new ** message comes in or the timeout value is reached. ** +** There is no guarantee that this routine will return if +** CFE_SB_DeletePipe() is called from another task while this routine +** is blocking with TimeOut #CFE_SB_PEND_FOREVER. +** ** \par Assumptions, External Events, and Notes: ** Note - If an error occurs in this API, the *BufPtr value may be NULL or ** random. Therefore, it is recommended that the return code be tested From f6d59ac7bc7b88c7bc7515a9f9f180465045bbc8 Mon Sep 17 00:00:00 2001 From: Jonathan Bohren Date: Wed, 11 Aug 2021 14:07:26 -0400 Subject: [PATCH 2/2] Removing trailing white space from comment --- modules/core_api/fsw/inc/cfe_sb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core_api/fsw/inc/cfe_sb.h b/modules/core_api/fsw/inc/cfe_sb.h index 5b03cbe99..b4eebf81b 100644 --- a/modules/core_api/fsw/inc/cfe_sb.h +++ b/modules/core_api/fsw/inc/cfe_sb.h @@ -99,7 +99,7 @@ CFE_Status_t CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const c ** associated with the pipe. All subscriptions made for this pipe by ** calls to #CFE_SB_Subscribe will be automatically removed from the ** SB routing tables. Any messages in the pipe will be discarded. -** +** ** If this routine is called from one task while execution of another ** task is blocked by a call to CFE_SB_ReceiveBuffer() with TimeOut ** #CFE_SB_PEND_FOREVER, there is no guarantee that