Le 20/12/12 17:24, Fredrik Orderud a
écrit :
Hi,
this is a good starting point. Do you expect that
shared_pri_mutex<
UNSPECIFIED_PRIORITY> behaves as shared_mutex?
The enum seems ok to me, but maybe, having specific classes at the
user level could introduce less constraints: shared_mutex,
shared_mutex_prio_shared, , shared_mutex_prio_exclusive. This
doesn't means that the implementation could not use a unique
implementation as far as there is no loss on performances.
I understand it as probe of concept.
Yes, fifo priority needs a different implementation. This could be
done later on.
I would prefer to integrate into Boost an implementation that takes
in account upgrade-locking and timed operations. As soon as we have
a complete and correct implementation, with enough test and
documentation we could integrate them in a release. The
documentation will need a motivation, why do we need them? If you
can work on some of these subjects the integration could be do
sooner.
Anyway, for the time been I have somme minor remarks:
* the enum literals should be in lowercase and I would prefer a enum
class.
//enum class shared_mutex_priority
BOOST_SCOPED_ENUM_DECLARE_BEGIN(shared_mutex_priority)
{
unspecified,
exclusive,
shared
}
* mutex are not copiable
BOOST_THREAD_NO_COPYABLE(shared_pri_mutex)
* protect the use of interruptions with
BOOST_THREAD_PROVIDES_INTERRUPTIONS as in trunk
#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
boost::this_thread::disable_interruption do_not_disturb;
#endif
* boost::mutex::scoped_lock is deprecated
Use
boost::unique_lock<boost::mutex> lk(state_change);
instead of
boost::mutex::scoped_lock lk(state_change);
as in trunk.
Maybe it is worth creating a Trac ticket.
I would be able to take a deeper look beginning of next year.
Thanks for working in this proposal.
Best,
Vicente