Wed 11 Apr 2007 03:17:35 AM UTC, original submission:
I raised an issue in bug #19161 that various places in api_lib.c used 1ms waits as if they were polls. In that bug I said I was wrong, but actually I wasn't: netconn_delete does this twice, while trying to purge the recvmbox and acceptmbox.
So I think we do need some form of new sys abstraction to allow a polled wait on an mbox that returns right away if it is not available.
I suggest something along the lines of this in sys.h:
/* sys_mbox_tryfetch() returns SYS_MBOX_EMPTY if appropriate */
#define SYS_MBOX_EMPTY SYS_ARCH_TIMEOUT
#if SYS_HAS_MBOX_TRYFETCH
extern u32_t sys_arch_mbox_tryfetch(sys_mbox_t mbox, void **msg);
#define sys_mbox_tryfetch(_mb,_m) \
sys_arch_mbox_tryfetch((_mb),(_m))
#else
#define sys_mbox_tryfetch(_mb,_m) \
sys_arch_mbox_fetch((_mb),(_m), 1)
#endif
with a corresponding #define in opt.h for SYS_HAS_MBOX_TRYFETCH. Initially this will default to 0 to preserve existing behaviour for ports. Perhaps in a while it can default to 1.
But I know there's a lot going on in this area, so I want to know if anyone had any other plans for this function before I do something.
|