/* Creates an empty mailbox for maximum "size" elements.  */
err_t sys_mbox_new(sys_mbox_t *mb, int size)
/* Creates an empty mailbox for maximum "size" elements.  */
err_t sys_mbox_new(sys_mbox_t *mb, int size)
{
    struct sys_mbox *mbox;
    LWIP_UNUSED_ARG(size);
    mbox = (struct sys_mbox *)malloc(sizeof(struct sys_mbox));
    if (mbox == NULL) {
        return ERR_MEM;
    }
    memset(mbox, 0, sizeof(struct sys_mbox));
    mbox->first = mbox->last = 0;
    sys_sem_new(&mbox->not_empty, 0);
    sys_sem_new(&mbox->not_full, 0);
    sys_sem_new(&mbox->mutex, 1);
    mbox->wait_send = 0;
    *mb = mbox;
    return ERR_OK;
}