-
Notifications
You must be signed in to change notification settings - Fork 85
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
Replace session pointer with refcount #320
Conversation
* fix: build tests only in c11 * fix: remove c11 macros from examples * feat: add a way to force c99 standard * ci: add a c99 compilation test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cppcheck (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
#define _Z_REFCOUNT_DEFINE(name, type) \ | ||
typedef struct name##_rc_t { \ | ||
type##_t *ptr; \ | ||
_z_atomic(unsigned int) * _cnt; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not define a struct name##_rc_inner_t {type##_t value; _z_atomic(unsigned int) _cnt;};
and have a single pointer to it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's an interesting suggestion.
Have to close this one with the main branch renaming. |
The entities
session
publisher
,subscriber
andqueryables
were sharing ownership of the same_z_session_t
pointer, this caused issues like #312. This PR replaces the session pointer with a refcounter on the session pointer.Had to modify how the refcount implementation was handled:
And renamed
pointer.h
/_sptr_t
torefcount.h
/_rc_t