Hello *,

I wrote a code which used a RAII idiom to lock multiple mutex instances in ctor and unlock them in dtor.

This resulted in the class similar to:

struct lock_many
{
    lock_many(mutex& m1, mutex& m2, ...)
       : m1_(m1), ...
    {
       boost::lock(*m1_, *m2_, ...);
    }

    ~lock_many()
    {
        //some asserts here, which ensure that either all mutex pointers are NULL or unequl to each other
        if(m1_==NULL && m2_==NULL && ...)
           return; // all are NULL no unlock needed


    }


   private:
     mutex* m1_;
     mutex* m2_;
};