httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexei Kosut <ako...@organic.com>
Subject threads
Date Mon, 12 Aug 1996 23:36:00 GMT
Random thoughts on Apache 2.0 and threading:

It seems increasingly obvious that, in Apache 2.0, we will have a
multithreaded server. It also seems obvious that we will need to support
more than one type of thread. RSThreads as the default, obviously, but
also, for example, Win32 threads, or POSIX threads where available: I am
given to understand this is the best way of doing a number of things.

But it also wreaks havoc with the modular system if a module needs to
access thread data. For example, a module has a good possiblity of needing
to set a thread-global variable, or use a mutex. Now, I imagine any of the
thread packages we'd use support all the neccessary functionality, but
unless someone changed everything in the last week since I last looked at
all this, they don't all use the same interface.

So I believe Apache needs a threads compatiblity layer for these sorts of
user-level functions. So a module can call do:

apache_mutex *my_mutex;
...
apache_mutex_init(my_mutex);
...
apache_mutex_lock(my_mutex);
...
apache_mutex_unlock(my_mutex);

and not worry about whether they're calling pthread_mutex_*, or the Win32
version, or (in the case of RSThreads or a back-compatible non-threaded
setting), nothing at all.

This is probably something that needs to be looked into. Especially if we
decide that modules need to be able to create their own threads (which is
a real possibility). In that case, we need to do some heavy-duty thinking.
I'm not quite sure what the ideal outcome would be, but I figured I'd at
least mention it, because I've been thinking about this sort of thing
lately.

Thanks

-- Alexei Kosut <akosut@organic.com>            The Apache HTTP Server 
   http://www.nueva.pvt.k12.ca.us/~akosut/      http://www.apache.org/


Mime
View raw message