X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=select.c;h=7e73771749051526d01ab205dd435ef12710f4a7;hp=ba9b563932546d4d3ac608d5a5d9f3ccbedcc88f;hb=46d07c5968b7de37943182f85499b30735145e03;hpb=b0bd74e35e935aa976b68c594def4e8d2c22ef95 diff --git a/select.c b/select.c index ba9b563..7e73771 100644 --- a/select.c +++ b/select.c @@ -88,9 +88,12 @@ int select_main(int polling, int *global_change, void (*lock)(void), void (*unlo * if no future timeout exists, select will wait infinit. */ +printf("-"); fflush(stdout); again: +printf("1"); fflush(stdout); /* process all work events */ if (next_work()) { +printf("2"); fflush(stdout); work = 1; goto again; } @@ -98,20 +101,23 @@ again: /* process timer events and get timeout for next timer event */ temp = 0; timer = nearest_timer(&select_timer, &temp); +printf("3"); fflush(stdout); if (temp) { +printf("4"); fflush(stdout); work = 1; goto again; } if (polling) timer = &no_time; -#warning TESTING - if (!timer) - printf("wait till infinity ..."); fflush(stdout); +//#warning TESTING +// if (!timer) +// printf("wait till infinity ..."); fflush(stdout); FD_ZERO(&readset); FD_ZERO(&writeset); FD_ZERO(&exceptset); +printf("5"); fflush(stdout); /* prepare read and write fdsets */ lcr_fd = fd_first; while(lcr_fd) { @@ -123,21 +129,23 @@ again: FD_SET(lcr_fd->fd, &exceptset); lcr_fd = lcr_fd->next; } +printf("6"); fflush(stdout); if (unlock) unlock(); rc = select(maxfd+1, &readset, &writeset, &exceptset, timer); if (lock) lock(); -#warning TESTING - if (!timer) - printf("interrupted.\n"); +//#warning TESTING +// if (!timer) +// printf("interrupted.\n"); if (rc < 0) return 0; if (global_change && *global_change) { *global_change = 0; return 1; } +printf("7"); fflush(stdout); /* fire timers */ #if 0 @@ -146,6 +154,7 @@ again: /* call registered callback functions */ restart: +printf("8"); fflush(stdout); unregistered = 0; lcr_fd = fd_first; while(lcr_fd) { @@ -164,10 +173,13 @@ restart: FD_CLR(lcr_fd->fd, &exceptset); } if (flags) { +printf("9"); fflush(stdout); work = 1; lcr_fd->cb(lcr_fd, flags, lcr_fd->cb_instance, lcr_fd->cb_index); +printf("0"); fflush(stdout); if (unregistered) goto restart; +printf("-"); fflush(stdout); return 1; } lcr_fd = lcr_fd->next;