![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
On Thu, Sep 03, 2009 at 04:55:54PM -0400, Jeffrey Hutzelman wrote: > A proper event loop blocks until there is an event (_any_ event), then > does some work. Polling is not an event loop. Polling wastes cycles and > can result in serious increases in power use besides. Not to mention all > of the points Nico has made with respect to the complexities of an API > trying to impose an event model on an application with several > intermediate libraries in between. That's why I pointed at the avahi libs. Samba internally has its own version of an event loop, and it would be outright impossible to adapt that to an event loop from an external lib. Adapting to those avahi libs was really easy for me, given that I have done quite a bit of async programming inside Samba before. There are other samples out there, but many of those (I've looked at some async DNS libs) assume select(2) as the blocking call. This won't work in modern systems anymore that use epoll other more efficient mechanisms. I'm not saying that avahi is the last word in this, but it worked pretty well for me. Internally the libs would use the async calls only, the sync wrappers would then provide a stub event loop around the async calls. That's at least what we do in the native Samba async code. Volker
Attachment:
signature.asc
Description: Digital signature