W3C home > Mailing lists > Public > www-lib@w3.org > October to December 1996

HTEvent_Loop: why stop at the first one?

From: Erik Selberg <selberg@cs.washington.edu>
Date: 24 Oct 1996 13:49:30 -0700
To: www-lib@w3.org
Cc: frystyk@w3.org
Message-ID: <rj74tjkxf39.fsf@bugbane.cs.washington.edu>
I've been looking at some performance drags, and I noticed when
HTEvent_Loop finally gets around to dealing with pending sockets (in
__ProcessFds or HTEvent_Dispatch, whichever version you prefer to
use): [windows stuff omitted for clarity]

PRIVATE int __ProcessFds( fd_set * fdsp, SockOps ops, CONST char * str) 
{
    SOCKET s ;
    if (THD_TRACE)
	TTYPrint(TDEST, "Processing.. %s socket set. max_sock is %d\n",
		str, max_sock);
    
    for (s = 0 ; s <= max_sock; s++) {
        if (FD_ISSET( s, fdsp)) 
	return __DoCallback( s, ops);
    }
    return HT_OK;
}

basically, even if there are more than 1 set socket, you still quit
after having processed one. [note: this does mean that for every
EventLoop iteration, you can do one read AND one write (and one
exception!)].

I was wondering why this was chosen, vs. something like:

PRIVATE int __ProcessFds( fd_set * fdsp, SockOps ops, CONST char * str) 
{
    SOCKET s ;
    int e;
    if (THD_TRACE)
	TTYPrint(TDEST, "Processing.. %s socket set. max_sock is %d\n",
		str, max_sock);
    
    for (s = 0 ; s <= max_sock; s++) {
        if (FD_ISSET( s, fdsp)) 
	e = __DoCallback( s, ops);
        if (e != HT_OK) return e; /* error condition */
    }
    return HT_OK;
}

-Erik

-- 
				Erik Selberg
"I get by with a little help	selberg@cs.washington.edu
 from my friends."		http://www.cs.washington.edu/homes/selberg
Received on Thursday, 24 October 1996 16:49:31 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:27 GMT