|
Threads-Devel : |
Subject: [Threads-devel] RFC: 1st pthread shared_mutex refactoring patch
From: Fredrik Orderud (forderud_at_[hidden])
Date: 2013-01-07 14:32:03
The attached patch is intended as a 1st step towards separation of the
"locking policy" parts from the "synchronization" parts of shared_mutex.
This separation is achieved by moving state_data member checks and
manipulation into new methods in state_data. The separation is currently
only done for exclusive and shared locking, but I will complete the
separation to also cover upgrade locking if there is consensus that this is
a good strategy. state_data can then be encapsulated with all data members
private.
Advantages of the separation:
* Simplify implementation of different locking prioritization policies:
Only requires reimplementation of state_data, with (hopefully) no changes
to the outer shared_mutex class.
* Simplify implementation of "lock-free" synchronization (as in win32
counterpart): Can be done in shared_mutex without touching the "locking
policy" logic in state_data.
Any comments or feedback will be highly appreciated.
Thanks in advance,
Fredrik Orderud