<div dir="rtl"><div dir="ltr">Hi.<br><br>Thanks for the explanation.<br></div><div><br><div class="gmail_quote"><div dir="ltr">2009/8/25 Jerry Johns <span dir="ltr">&lt;<a href="mailto:Jerry.Johns@nuvation.com">Jerry.Johns@nuvation.com</a>&gt;</span></div>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div dir="ltr">











<div link="blue" vlink="purple" lang="EN-US">

<div>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">The LiveMedia library uses the magical
world of select(), which allows for monitoring multiple file handle descriptors
(or in this case, sockets) to monitor for incoming/outgoing data.</span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">By blocking on this select() call, an event
loop can process multiple socket handles in a single execution context,
effectively giving the impression of multi-threaded behaviour.</span></font></p></div></div></div></blockquote><div dir="ltr"><br>I had a vague idea of how it works, and after your explanation have read this article:<br>
<a href="http://www.lowtek.com/sockets/select.html">http://www.lowtek.com/sockets/select.html</a><br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div dir="ltr"><div link="blue" vlink="purple" lang="EN-US"><div><p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"></span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">LiveMedia has a scheduler that you
registers a function callback with a specific socket handle. A basic pseudo
code would be:</span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">loop: </span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">{</span></font></p>

<p style="margin-left: 0.5in;"><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">select(descriptor set) </span></font><font size="2" color="navy" face="Wingdings"><span style="font-size: 10pt; font-family: Wingdings; color: navy;">à</span></font><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> Blocking call</span></font></p>


<p style="margin-left: 0.5in;"><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">for each SET file handle
in descriptor set</span></font></p>

<p style="margin-left: 0.5in;"><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">       look up
corresponding function handler.</span></font></p>

<p style="margin-left: 0.5in;"><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">       Invoke handler</span></font></p>

<p style="margin-left: 0.5in;"><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">end for</span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">}</span></font></p><br></div></div></div></blockquote></div><br></div><div dir="ltr">That&#39;s what I don&#39;t get - how the scheduler handles incoming data? It forks new processes to handle it (unlikely)?<br>
Or it just tried to process the data as fast as possible in a single loop?<br><br>Regards.<br></div></div>