On 18/06/13 22:16, Elazar Leibovich wrote: > I'm using it as a fake "always non-blocking" file descriptor. > > My main libevent-like poll loop looks like: > > poll(fds) > for fd in fds: > if fd.revents | POLLIN: > fd.read_callback() > if fd.revents | POLLOUT: > fd.write_callback() > > Now let's say I want a fake filedescriptor that always reads 'z's (a > sleepy fd). 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.
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. Shachar
_______________________________________________ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il