Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: define receive queue sizing constant #17

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rureverek
Copy link

Changes

  • Small change: defines receive notification queue sizing constant

Related Issue(s)

Closes #15

@rureverek rureverek requested a review from t-bre February 17, 2023 12:09
@rureverek rureverek changed the title Define receive queue sizing constant feat: define receive queue sizing constant Feb 17, 2023
@t-bre t-bre self-assigned this Feb 17, 2023
@t-bre t-bre added the feature New feature or request label Feb 17, 2023
@t-bre t-bre added this to the STAG 9 milestone Feb 17, 2023
inc/rtcan.h Outdated
@@ -122,7 +122,7 @@ typedef struct
#define RTCAN_TX_QUEUE_SIZE (RTCAN_TX_QUEUE_LENGTH * RTCAN_TX_QUEUE_ITEM_SIZE)

#define RTCAN_RX_NOTIF_QUEUE_LENGTH 10
#define RTCAN_RX_NOTIF_QUEUE_ITEM_SIZE 1 // one pointer = 1x ULONG
#define RTCAN_RX_NOTIF_QUEUE_ITEM_SIZE (sizeof(rtcan_msg_t*) / sizeof(ULONG)) // one pointer = 1x ULONG
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the right constant value, but I don't think this should be the name of the constant that users use in their code. This particular group of constants is internal to RTCAN (used to send pointers to received messages to the RTCAN Rx thread for dispatch to subscribers).

I suggest:

// user constant
#define RTCAN_RX_QUEUE_ITEM_SIZE (sizeof(rtcan_msg_t*) / sizeof(ULONG))

// internal constant
#define RTCAN_RX_NOTIF_QUEUE_ITEM_SIZE (RTCAN_RX_QUEUE_ITEM_SIZE)

I think we should perhaps rename all of the internal constants, or #undef them at the end of the header so they don't get exposed to users and potentially cause confusion. Maybe they should be prefixed with an underscore if they are internal?

@rureverek rureverek requested a review from t-bre February 27, 2023 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: define receive queue item sizing constant in rtcan.h
2 participants