libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] ContentReaderCallback has changed behaviour in lates


From: David J Myers
Subject: Re: [libmicrohttpd] ContentReaderCallback has changed behaviour in latest releases
Date: Fri, 1 Feb 2013 10:32:23 -0000

My server must stream to a number of concurrent clients. Does that not
therefore mean that I need a multi-threaded mode, not the single-threaded
external-select mode?

If I use the thread-per_connection mode, what is the consequence of
returning zero from the callback instead of blocking? Does it create a new
thread for the next callback?

If I use the thread-pool mode, I can't return zero from the callback, but
what would be the consequence of blocking in this mode? This is my preferred
mode.

Best regards
David





-----Original Message-----
From: Christian Grothoff [mailto:address@hidden 
Sent: 01 February 2013 09:41
To: David J Myers
Cc: 'libmicrohttpd development and user mailinglist'
Subject: Re: ContentReaderCallback has changed behaviour in latest releases

Please look at src/examples/fileserver_example_external_select.c

The main point is that *you* do the 'select' call in your main loop and just
ask MHD for select sets and timeout values.  In your response callback, you
can then safely return '0' if you don't have any data ready (which will
cause MHD to remove the respective FD from the select set for the next
MHD_get_fdset call).  You are then responsible for adding a
timeout/socket/etc. to your external select call to ensure that MHD is woken
up if your response callback is (possibly) ready again.

External select is the default if you do not pass any other threading mode
option, thus you don't find it as a MHD_USE option...

Happy hacking!

-Christian




reply via email to

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