|
From: | Dirk Ziegelmeier |
Subject: | Re: [lwip-users] 'Avoiding sys_thread_new' and 'RTOS Integration' |
Date: | Mon, 10 Oct 2016 10:11:56 +0200 |
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).
[Prev in Thread] | Current Thread | [Next in Thread] |