|
From: | Jonathan Larmour |
Subject: | Re: [lwip-users] netconn_delete and _recv not thread safe |
Date: | Fri, 15 Dec 2006 17:15:42 +0000 |
User-agent: | Thunderbird 1.5.0.8 (X11/20061107) |
Krueger, Don wrote: >Jifl wrote:
A packet, or a connection to a listening socket, may arrive in the gap between removing mbox items, and deleting the mboxes. For example:
[snip]
Doesn't the API_MSG_DELCONN message posted just prior to the above code already prevent any further packets from being placed in the recvmbox?
It seems that you're right. After having thought I "fixed" the problem, it then showed itself up again a bit later.
The problem I was having evidently wasn't what I had thought it was - the real problem was related to sys_arch_mbox_fetch being called with a timeout of 1. My OS does timeouts by providing absolute tick values for the kernel clock, not relative timeouts. A timeout of 1 can mean that a context swap can cause the timeout to appear to be in the past, which causes an immediate "timeout" failure. This means that not all messages in the mbox get removed before the mbox is deleted (I had been thinking that they must have just arrived).
I'm now treating a timeout of 1 specially as if it were a poll, and so far all is well.
Sorry for the false alarm. Jifl -- eCosCentric http://www.eCosCentric.com/ The eCos and RedBoot experts ------["The best things in life aren't things."]------ Opinions==mine
[Prev in Thread] | Current Thread | [Next in Thread] |