You are right, this will also work.

Even in lwIP 1.4.1 the prototype for these functions was:
> err_t sys_sem_new(sys_sem_t *sem, u8_t count);
> err_t sys_mbox_new(sys_mbox_t *mbox, int size);
>
> These functions clearly don't return anything else other than error and
> the buffer for semaphore/mailbox has to be provided by user.
>
> These can work the way you describe but only if you define sys_sem_t
> and sys_mbox_t to be pointers, which is not the best approach. If you
> define them as storage with the same size and alignment as the "real"
> semaphore/mailbox, then these functions can just construct the object
> into the storage, with no memory allocation (except the storage for
> mailbox contents).
>
_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to