Hello
I am testing the boost mutex/lock classes in order to implement a
multiple reader single writer model.
Because of this I thought that the shared mutex with lock_shared and
lock_unique would be perfect. I'm finding that the performance is no
better than with a simple mutex.
My writer is adding a bunch of elements, locking the shared container
exclusivelly until it is done. The readers looks at all elements of
the container, locking on a per element basis.
Any ideas as to why the shared mutex would be slower in this case than
the simple mutex?
This is the code for my producer thread and my consumers (as a side
note, employee_set is a multi index):
typedef boost::shared_mutex mutex_type;
typedef boost::shared_lock