
Howard Hinnant wrote:
On Aug 21, 2007, at 3:06 PM, Roland Schwarz wrote:
What does public lock unlock provide, that cannot be achieved with moveable locks also?
[...}
Alternatively you may want to write your own mutexes, and have them work with the std::supplied locks. This can't be done with the boost design, because there is no standard interface for your mutex to implement.
A practical example: Boost.Interprocess mutexes. I had to reimplement all the locks (following your the proposed interface) because scoped lock has no public requirements on what a mutex should provide. Locks were also tightly coupled with boost::condition via friendship. If generic algorithms are provided, we can safely use them with Boost.Interprocess mutexes and locks. I could also reuse standard locks with process-shared mutexes if a user prefers them or programs generic algorithms templatized on the mutex type. Process-shared condition variables would be a different beast. We'll need to define a new condition variable type (I'm afraid that specialization is not enough, because this pshared_condition should also work with arbitrary mutex types). Regards, Ion