<html style="direction: ltr;">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<style type="text/css">body p { margin-bottom: 0.2cm; margin-top: 0pt; } </style>
</head>
<body style="direction: ltr;"
bidimailui-detected-decoding-type="UTF-8" bgcolor="#FFFFFF"
text="#000000">
<div class="moz-cite-prefix">On 18/06/13 22:16, Elazar Leibovich
wrote:<br>
</div>
<blockquote
cite="mid:CAHNTFmJaPD3XJHFkt1ZU8+_NGmbx0EYaTn1z=jJ+5sr8vZMYNw@mail.gmail.com"
type="cite">
<div dir="ltr">I'm using it as a fake "always non-blocking" file
descriptor.
<div><br>
</div>
<div style="">My main libevent-like poll loop looks like:</div>
<div style=""><br>
</div>
<div style=""><font face="courier new, monospace"> poll(fds)</font></div>
<div style=""><font face="courier new, monospace"> for fd in
fds:</font></div>
<div style=""><font face="courier new, monospace"> if
fd.revents | POLLIN:</font></div>
<div style=""><font face="courier new, monospace">
fd.read_callback()</font></div>
<div style=""><font face="courier new, monospace"> if
fd.revents | POLLOUT:</font></div>
<div style=""><font face="courier new, monospace">
fd.write_callback()</font></div>
<div style=""><br>
</div>
<div style="">Now let's say I want a fake filedescriptor that
always reads 'z's (a sleepy fd).</div>
</div>
</blockquote>
Why? What you just did was to turn the whole thing into a
non-sleeping loop. If that's the case, simply call poll with a zero
timeout, so it won't sleep, and call your callback at the end of
each loop. No need to artificially introduce another file descriptor
into the mix.<br>
<br>
Mind you, I still don't understand WHY you'd want such a thing. This
code will, by definition, consume 100% CPU all the time.<br>
<br>
Shachar<br>
</body>
</html>