[Top][All Lists]

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

RE: [lwip-users] Socket API thread safe?

From: Wilfred Hoogerbrugge
Subject: RE: [lwip-users] Socket API thread safe?
Date: Tue, 8 Jun 2004 14:30:27 +0200

> Wilfred Hoogerbrugge wrote:
> > As the subject already shows I wonder if the lwIP socket API is multi
> > thread safe.
> >
> > I remember having read somewhere it is, but can’t find that
> statement back.
> >
> > As I’m hunting a race condition in my environment using lwIP +
> socket API,
> > I wonder if the problem my lay in the fact I’ve two threads calling the
> > socket API (one for sending using sendto and one for receiving using
> > recvfrom).
> >
> > I already found out that the sys_sem_wait() function sys.c is sometimes
> > re-entered (about once a hour), which it doesn’t seem to be designed for
> > (?).
> >
> > Thanks for reading (and answering).
> >
> > BTW: I’m using lwIP 0.7.1
> I'm using the sockets API with several threads simultanously under QDOS
> (web server, browser, mailclient, TCP echo, etc.) and have little to no
> problems since I implemented the "lightweight protection" mechanism for
> the lower level.
> sys_sem_wait() looks OK for being re-entered by a different thread, since
> sys_arch_timeouts() provides the timeouts for the _current_ thread only.
> I vaguely remember a similar problem to yours from the early days when my
> sys_arch_sem_wait() implementation had a tricky little bug. This looks
> like the first place to check.
> All the best
> Peter

I have implemented the lightweight protection mechanism. Contained a bug
first time, but is fine now (had it reviewed by someone else).

Your comment on sys_sem_wait makes sense, I didn't take in account timeouts
are stored per thread.



reply via email to

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