lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Socket read/write and threads


From: Simon Goldschmidt
Subject: Re: [lwip-users] Socket read/write and threads
Date: Mon, 11 Jan 2010 15:50:14 +0100

Yoav Nissim wrote:
> Simon,
> Is the half duplex limitation only a socket implementation issue? other
> than the missing locks, what else is missing? using the netconn API
> seems to result in the same problem.

Well, the problem really lies in the netconn API (and the sockets API is 
implemented by more or less directly using the netconn API).

> Isn't the TCPIP thread performing operations one at a time anyway?

It does (though not always). But the problem here is that both operations use 
the same 'finished' semaphore to know when the tcpip_thread has finished the 
operation:

1. Thread 1 calls read
2. Thread 2 calls write
3. tcpip_thread executes the read
4. tcpip_thread sets finished-semaphore for read
-> At this point, it's unpredictable which thread is woken (read or write) as 
both are pending on the same semaphore.

Plus, write operations may be splitted into multiple time slices if the send 
window or buffer space does not allow sending all data at a time.

Simon
-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01




reply via email to

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