[ccan] ccan: the psuedo "networking" module.

Allan Ference f.fallen45 at gmail.com
Sat Dec 8 07:09:25 EST 2012


Hey rusty,

Sorry for yestarday's email, I was drunk and somewhat clicked send when
it's incomplete...

So here's the idea:

       struct io_service {
                struct sock_events *sevents;
       };

       /* ... your functions, new_listener() and so on */
       /* Creates a thread */
       void start_service(struct io_service *service);
       /* Blocks until all polling is done.  */
       void run_service(struct io_service *service);


You then would call some functions like:
         add_listener(&my_io_service, host, port, ...);

Then on main():
        for (int i = 0; i < nthreads; i++)
              start_service(&my_io_service);
        run_service(&my_io_service);

Or we could hide the implementation of io_service in the source file and
work with that.

Lemme know what you think

Thanks!
Allan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/ccan/attachments/20121207/5ab41822/attachment.html>


More information about the ccan mailing list