That's why I use timeout=0 and deal with thread waiting (to avoid polling the core to 100%) myself using the OS.<div>A Sleep(1) already does wonders.</div><div><br></div><div>Ruud<br><br><div class="gmail_quote">On Thu, Aug 2, 2012 at 8:57 PM, Jack Applegame <span dir="ltr"><<a href="mailto:japplegame@gmail.com" target="_blank">japplegame@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>I check ENet sources and found that it
uses blocking(synchronous) socket operations. This means there is
no way to wake-up waiting thread without serious modification of
sources. :(<br>
<br>
02.08.2012 12:13, Ruud van Gaal wrote:<br>
</div>
<blockquote type="cite">I'd always use timeout=0, except for really simple
apps perhaps.
<div>As for waking up threads then, it's just standard OS things
(not related to ENet); check out semaphores and waitable
objects.</div>
<div><br>
</div>
<div>Cheers,</div>
<div>Ruud<div class="im"><br>
<br>
<div class="gmail_quote">On Thu, Aug 2, 2012 at 8:58 AM, Jack
Applegame <span dir="ltr"><<a href="mailto:japplegame@gmail.com" target="_blank">japplegame@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello!<br>
<br>
I use separate thread for calling enet_host_service() with 1
second timeout.<br>
Is there a way to wake-up ENet from other thread, if It is
necessary to send a packet immediately without waiting for
timeout?<br>
Setting timeout to zero isn't good way, because in this case
service thread fully loads one processor core even if it is
no network activity.<br>
<br>
Best regards<span><font color="#888888"><br>
Jack Applegame<br>
_______________________________________________<br>
ENet-discuss mailing list<br>
<a href="mailto:ENet-discuss@cubik.org" target="_blank">ENet-discuss@cubik.org</a><br>
<a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br>
</font></span></blockquote>
</div>
<br>
</div></div><div class="im">
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
ENet-discuss mailing list
<a href="mailto:ENet-discuss@cubik.org" target="_blank">ENet-discuss@cubik.org</a>
<a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a>
</pre>
</div></blockquote>
<br>
</div>
<br>_______________________________________________<br>
ENet-discuss mailing list<br>
<a href="mailto:ENet-discuss@cubik.org">ENet-discuss@cubik.org</a><br>
<a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br>
<br></blockquote></div><br></div>