Boost logo

Threads-Devel :

From: Anthony Williams (anthony_at_[hidden])
Date: 2006-03-02 02:58:42

David Abrahams <dave_at_[hidden]> writes:

> Anthony Williams <anthony_at_[hidden]> writes:
>> I thought I'd start off some discussion about mutexes, to inaugurate
>> our new mailing list.
>> The mutex is the basic synchronization primitive for shared-memory
>> threading models, such as that of boost.thread, so it is very
>> important that the model, and implementation, is sound. With a
>> working mutex, you can build more pexpressive synchronization
>> mechanisms, such as the smart shared pointers proposed by Roland.
> I think it's great to discuss these things, and we should probably
> pursue them. That said, and I hate to be a killjoy, don't we need to
> focus on the library reimplementation and stabilization before we look
> at new design ideas?

Agreed 100%. The main point of my email was to discuss the issues surrounding
mutex implementation, and the details of my new implementation. I also wanted
to throw up issues surrounding mutexes in general, and the current interface.


I have written a class called basic_mutex, and another called
basic_recursive_mutex, which are now used for the backend of boost::mutex and
boost::recursive_mutex (and their try_xxx variants) for Win32 on the
thread_rewrite branch. I have also written a basic_checked_mutex, which
performs additional checks, to ensure that only the locking thread can unlock
the mutex, and to avoid recursive locks, though this is not yet in CVS.

Much of the rest of the email was describing the forces that led me to this
implementation, most of which are general, and will apply to any
implementation of boost::mutex.


Anthony Williams
Software Developer
Just Software Solutions Ltd

Threads-Devel list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at