lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] LWIP - netconn with cooperative scheduling


From: Mark Phillips
Subject: [lwip-users] LWIP - netconn with cooperative scheduling
Date: Thu, 21 May 2009 10:05:54 -0400
User-agent: Thunderbird 2.0.0.21 (Windows/20090302)

Hi, all!

I have ported the LWIP stack, and got it basically working. However, I am running into some problems with multiple sockets, and I was wondering if my structure is wrong.

Unlike many OS'es, I am running under a cooperatively-scheduled OS. A running task never gets interrupted except by a real interrupt, or when it voluntarily suspends.

I have 2 tasks running the basic stack; one calls ethernetif_input() repeatedly (and suspends after each call). The other one calls tcpip_thread().

The only places where lwip code can suspend is either:
a) when reading a mailbox which is empty (suspends once and then returns) - this is, in general, how the tcpip_thread suspends.

b) When waiting on a semaphore (suspends repeatedly until sem available or timeout).

I have several application tasks which are using the sockets. Some of these are listeners, some are initiators (they make the connection to a remote host). They are using the netconn_new, netconn_connect, netconn_recv, netconn_write, etc. functions. These functions are always called only at the application level (i.e. never from an interrupt).

I assumed that this would be a safe environment; i.e. that none of the netconn functions would suspend (waiting for mbox or sem) when it was unsafe for a different task to call one of these functions, but I suspect I may be wrong here?

As I said above, this works perfectly when, for example, I just have one or two listening sockets, but when I try to mix listening and initiating sockets, the whole thing comes crashing down.

Any advice will be appreciated!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]