[hackers] [libixp] Add a callback to run before select().

From: Kris Maglione <jg_AT_suckless.org>
Date: Sun Jun 17 23:02:42 2007

changeset: 64:8773cc4aefd3
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Sun Jun 17 17:01:24 2007 -0400
summary: Add a callback to run before select().

diff -r 04901ee1b2aa -r 8773cc4aefd3 include/ixp.h
--- a/include/ixp.h Sat Jun 02 11:03:53 2007 -0400
+++ b/include/ixp.h Sun Jun 17 17:01:24 2007 -0400
@@ -179,8 +179,10 @@ struct IxpConn {
 };
 
 struct IxpServer {
+ IxpConn *conn;
+ void (*preselect)(IxpServer*);
+ void *aux;
         int running;
- IxpConn *conn;
         int maxfd;
         fd_set rd;
 };
diff -r 04901ee1b2aa -r 8773cc4aefd3 libixp/server.c
--- a/libixp/server.c Sat Jun 02 11:03:53 2007 -0400
+++ b/libixp/server.c Sun Jun 17 17:01:24 2007 -0400
@@ -76,6 +76,8 @@ ixp_serverloop(IxpServer *s) {
 
         s->running = 1;
         while(s->running) {
+ if(s->preselect)
+ s->preselect(s);
                 prepare_select(s);
                 r = select(s->maxfd + 1, &s->rd, 0, 0, 0);
                 if(r < 0) {
Received on Sun Jun 17 2007 - 23:02:42 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:57:19 UTC