Thread blocking

Peter Nguyen peter.nguyen at ...35...
Wed Apr 28 13:39:16 CEST 2010


Hi Stefan,

Thanks for that. I was wondering though, the hanging does occur immediately
after the first request is received ie. the number of threads created is
currently irrelevant, given that after only one thread is created, the server
hangs.

Peter

Quoting Stefan Kalkowski <stefan.kalkowski at ...1...>:

> 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
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Genode-main mailing list
> Genode-main at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/genode-main
>






More information about the users mailing list