<br><br><div class="gmail_quote">On Wed, Sep 26, 2012 at 7:49 PM, Rahul Bedarkar <span dir="ltr"><<a href="mailto:rpal143@gmail.com" target="_blank">rpal143@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I have to capture kernel udev events through libudev. One of API<br>
provides asynchronous events by reading on file descriptor. I found<br>
that there two ways to do that.<br>
<br>
1) select call<br></blockquote><div><br></div><div>I guessed when u called select() it will block, and so u can be very efficient - doing nothing until necessary, but also resource being used up - as the process is solely dedicated to listenting for event only.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2) epoll<br>
<br></blockquote><div>good thing is u can parallel process other stuff at the same time, if after polling the replies from udev is not back yet. but the bad thing is response may not be so immediate, as u may be doing something else when the udev event comes in.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I also found that epoll is smarter and meant to replace old select call.<br>
<br>
What are your thoughts on these ? Which one is better ?<br>
<br>
Thanks<br>
Rahul B.<br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Regards,<br>Peter Teoh<br>