Boost logo

Boost Users :

Subject: [Boost-users] [interprocess] named_upgradable_mutex
From: Moritz (mokoman_at_[hidden])
Date: 2009-06-30 14:52:48


Hi everybody,

I have a question concerning the interprocess::updgradable::mutex.

My scenario:
I have a writer, which is manipulating an object in a
interprocess::managed_shared_memory. And I have 'n' readers which are
reading the object in the shared mem. If the writer is ready to write,
it should get the possibility as fast as possible. So this is a variety
of the classical readers/writers problem and I already found a good
solution that fits my requirements.
But this solution uses 3 mutexes and 1 counter so I am looking for a
more efficient solution.

The idea is that the writer locks the upgradable_mutex normally (calling
lock()) and the readers lock it sharable (calling lock_sharable()). If
the mutex is locked sharable and the writer tries to lock it normally,
another attempt to lock it sharable has to wait until the writer
succeeded in locking and unlocking the mutex.

Is this correct proceeding?

Thank you
Moritz


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net