mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 14:33:52 +01:00
Merge pull request #15485 from miri64/mbox/enh/mbox-unset
mbox: provide function to unset initialized mbox
This commit is contained in:
commit
52425330a3
@ -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.
|
||||
*
|
||||
* @param[in] mbox ptr to mailbox to operate on
|
||||
*/
|
||||
static inline void mbox_unset(mbox_t *mbox)
|
||||
{
|
||||
mbox->msg_array = NULL;
|
||||
mbox->cib.mask = 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -101,13 +101,13 @@ typedef struct {
|
||||
|
||||
static inline bool sys_mbox_valid(sys_mbox_t *mbox)
|
||||
{
|
||||
return (mbox != NULL) && (mbox->mbox.cib.mask != 0);
|
||||
return (mbox != NULL) && (mbox_size(&mbox->mbox) != 0);
|
||||
}
|
||||
|
||||
static inline void sys_mbox_set_invalid(sys_mbox_t *mbox)
|
||||
{
|
||||
if (mbox != NULL) {
|
||||
mbox->mbox.cib.mask = 0;
|
||||
mbox_unset(&mbox->mbox);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user