[riot-notifications] [RIOT-OS/RIOT] mbox: provide function to unset initialized mbox (#15485)

Martine Lenders notifications at github.com
Fri Nov 20 15:17:26 CET 2020

@miri64 commented on this pull request.

> @@ -185,6 +185,17 @@ static inline size_t mbox_avail(mbox_t *mbox)
     return cib_avail(&mbox->cib);
+ * @brief   Unset's the mbox, effectively deinitializing and invalidating it.

>From https://github.com/RIOT-OS/RIOT/pull/15484#discussion_r527685144

> This leaks a possibly supplied queue. Maybe better call it mbox_release_queue?
The mbox actually works without queue, it'd just be synchronous from that point on.
> This is also a bit dangerous, if this is called with messages in the queue, they get lost. If there's a sender that was previously waiting, it would be stuck there until the queue transitions from full to empty again.

The `sys_mbox_set_invalid()` function is called whenever a netconn (lwIP's sock equivalent) is closed or finished, so this isn't a risk, but maybe that function should be fixed in the way that readers and writers are also released and removed somehow.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20201120/182a917c/attachment-0001.htm>

More information about the notifications mailing list