[ECOS] FreeBSD stack / more threads, one socket

Nick Garnett nickg@ecoscentric.com
Tue Aug 31 10:18:00 GMT 2004


"Richard Rauch" <Richard.Rauch@vipa.de> writes:

> Hi all,
> 
> we are using the FreeBSD stack and our application works with several
> threads.
> on one socket there are working 2 threads. the first is thread is waiting
> for socket events with select( ), the second thread is calling send( ) and
> receive( ).
> is this allowed?
> I'm asking, because when we have heavy communication load, then the stack
> hangs (e.g no answers to ping) and we are searching for the reason

I don't think that the BSD stack really expects you to be doing IO on
a socket that you are also selecting on. To start with, it would be
totally non-deterministic what happens when a packet arrives, does it
satisfy the recv() or the select(). Similarly with transmit, when the
buffers empty enough to allow a new transmission, does it satisfy the
select(), or release the send()?

I think you need to look more closely at your program, there seems to
be some confusion about what it want to do with this socket. I would
certainly never structure a program like this, on eCos, BSD or Linux.

Of course your problems may be unrelated, but I think this needs
fixing if only to eliminate it as a source of bugs.

-- 
Nick Garnett                    eCos Kernel Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list