Sergey Lyubka wrote: > I am thinking about the threading model for SHTTPD callbacks. > Which allows to block in the callback. > > Currently, it is a state machine. Callback is provided with an input > and output buffers, and must check for overflows, etc, and keep state > if it outputs lots of data (e.g. is called more than once for single > request) > > This state machine is quite hard to program. Threading way is much > simpler, although might not be that efficient. But performance is a > non-goal > for shttpd. Simplicity is. > > This is why I am poking about threading support. The idea is to spawn > a thread for a callback, and execute callback in that thread. Thus > callback > may be written in synchronous way, may block etc. So a thread would be spawned and then exit when it has served a single request? Or would it have a longer life? Is it possible to have a pool of server threads that service requests? It would then be possible to have something like a message queue where each incoming request is dispatched to the pool and the next thread to get the message processes the request.
I guess I just don't understand how long a thread will live. Also be aware that on RTEMS we really do like to control the number of created objects and most systems have hard limits. So some type of thread pool arrangement would work best. It would also avoid flood issues swamping even a UNIX system. RTEMS has real threads -- both POSIX threads and Classic API tasks. In RTEMS, POSIX threads is an optional configure time item and Classic API tasks are always enabled. > > Another way to do it is with coroutines, but this is hacky in C. > Threads are common. There is no reason to do something like this. :) --joel > > On 19/11/2007, *Joel Sherrill* < [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > Sergey Lyubka wrote: > > The logo is put on shttpd.sourceforge.net > <http://shttpd.sourceforge.net> <http://shttpd.sourceforge.net> > > > > A question for you, RTEMS guys. > > Does RTEMS have thread support, or lower level threading > > primitives, like contexts? > RTEMS threading via POSIX threads or what > we refer to as the Classic API. But are you > referring to some specific shttpd feature? > > --joel > > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ shttpd-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/shttpd-general
