/* Deallocates a mailbox. If there are messages still present in the mailbox when the mailbox is deallocated, it is an indication of a programming error in lwIP and the developer should be notified.  */
void k_mbox_free(k_mbox_t *mb)
/* Deallocates a mailbox. If there are messages still present in the mailbox when the mailbox is deallocated, it is an indication of a programming error in lwIP and the developer should be notified.  */
void k_mbox_free(k_mbox_t *mb)
{
    if (mb != NULL) {
        k_mbox_t *mbox = mb;
        k_sem_take(&mbox->mutex, K_FOREVER);
        k_sem_delete(&mbox->not_empty);
        k_sem_delete(&mbox->not_full);
        k_sem_delete(&mbox->mutex);
        BT_DBG("sys_mbox_free: mbox 0x%lx\n", mbox);
        free(mbox);
    }
}