httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@gonzo.ben.algroup.co.uk>
Subject Re: threads
Date Fri, 16 Aug 1996 23:18:34 GMT
Alexei Kosut wrote:
> 
> 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.

I've also been thinking about this (not surprisingly, since I've been poking
at Win32 threads), and it seems to me that we do need the compatibility layer,
however, I'm not sure that there's any need to look further than rsthreads.
That is, the compatibility layer may as well be the rsthreads API.

Certainly what I've done so far of the Win32 stuff suggests that this is the
right way round to do it, but I'll comment further when I've done more.

Cheers,

Ben.

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

-- 
Ben Laurie                  Phone: +44 (181) 994 6435
Freelance Consultant and    Fax:   +44 (181) 994 6472
Technical Director          Email: ben@algroup.co.uk
A.L. Digital Ltd,           URL: http://www.algroup.co.uk
London, England.            Apache Group member (http://www.apache.org)

Mime
View raw message