Thread blocking

Stefan Kalkowski stefan.kalkowski at ...1...
Wed Apr 28 12:23:53 CEST 2010


On Wednesday, 28. April 2010 12:02:18 Peter Nguyen wrote:
> Hi,

Hi Peter,

>
> Attached is the http_srv code under question. I think the source of the
> problem is when lwip_accept is called again after creating the thread. The
> HTTP thread does not execute at all when lwip_accept in main() is invoked
> again. However, when i insert a call to sleep in the infinite loop, the
> HTTP thread executes. I also suspect I might not have done enough to make
> the server truly multithreaded.
>
> Peter

after quickly looking at your code line 167 was eye-catching to me. You create 
your thread object on the stack within a loop, so every time your loop body 
is finished the thread gets deconstructed.
You should construct the thread using the heap or have a static set of worker 
threads responding to the requests.
Another problem of creating threads on the stack of another one is, that the 
creator will run out of stack space quickly.

regards Stefan

>
> Quoting Christian Helmuth <christian.helmuth at ...1...>:
> > Hello Peter,
> >
> > On Wed, Apr 28, 2010 at 04:47:00PM +0930, Peter Nguyen wrote:
> > > Any ideas as to what's going on?
> >
> > From your description, I guess your code is buggy, but you (again) did
> > not send sources. Maybe someone on the list could help you, if you
> > send the relevant code snippets from your program.
> >
> > Ciao
> > --
> > Christian Helmuth
> > Genode Labs
> >
> > http://www.genode-labs.com/ · http://genode.org/
> >
> > Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
> > Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth
> >
> > -------------------------------------------------------------------------
> >----- _______________________________________________
> > Genode-main mailing list
> > Genode-main at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/genode-main



-- 
Stefan Kalkowski
Genode Labs Developer
http://genode-labs.com




More information about the users mailing list