[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] [bug #44032] LWIP_NETCONN_FULLDUPLEX: select might work
From: |
Fabian Koch |
Subject: |
Re: [lwip-devel] [bug #44032] LWIP_NETCONN_FULLDUPLEX: select might work on invalid/reused socket |
Date: |
Tue, 17 Mar 2015 07:54:18 +0000 |
Hey Joel,
Well the ultimate problem that "the application" has to keep track of all its
sockets over all different threads involved will never go away, but I guess
that's a given.
So you have scenarios like this:
"main application thread" creates a socket, creates a child thread, gives the
socket fd to the child thread but keeps track of it too.
Now when the child is blocking on accept() and the whole application is
supposed to be shut down, the main app thread can call close() on the socket
that the child thread is waiting on without the universe exploding as it used
to be in LWIP.
Same thing for full duplex protocols. They will also need a main thread that
creates a send and a receive thread and gives them the fd of a socket to
send/rec on. Or either of them creates a sockets and provides the others with
the fd.
Still you should have one main thread that keeps track of all socket fds.
So in essence, implementing the long awaited "multiple threads can work on the
same socket" feature in LWIP of course does not change the fact that
application developers need to know what they are doing with their sockets.
Now they just have to spread that knowledge among more threads than one.
Cheers,
Fabian