httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <>
Subject Re: cvs commit: apache-2.0/mpm/src/modules/mpm/winnt winnt.c
Date Fri, 13 Aug 1999 22:14:39 GMT
> There is no code yet, so it's okay that you didn't look at it.

I thought Dean had been hacking some up a while ago.  I guess I mis-read
a message at some point.  :)

> > conn_id = child_num + next_conn_id_num.
> conn_id = child_num * (maximum fds/process) + fd of connection.

Oops, typed it in to fast, what I meant was:

conn_id = child_num * 100 + next_conn_id_num.

No need to go through those hoops.  Since AFAIK, there will only be one
thread accepting connections, it can keep a count of connections, kind of
like the OS keeps the pid.  When a new request comes in, the accepting
thread just adds the next number in line to his child_num *100.  The * 100
keeps the numbers unique.

The problem with what you suggested above, is what happens when the fd is
something like 549?  It will spill over into another proesses #'s.

OK, reviewed this again, neither one of the above will garauntee
uniqueness, although mine will if the number of threads is ALWAYS < 100.
The algorithm I would choose would be:

conn_id = child_num * MAX_THREADS_PER_CHILD + count_num;
if (++count_num >= MAX_THREADS_PER_CHILD)
    count_num = 0;

There are problems with this when MAX_THREADS_PER_CHILD is too low.  But
it is a quick approx of what it should be.


Ryan Bloom
4205 S Miami Blvd	
RTP, NC 27709		It's a beautiful sight to see good dancers 
			doing simple steps.  It's a painful sight to
			see beginners doing complicated patterns.	

View raw message