Generic implementation of the LeftRight algorithm proposed by Ramalhete and Correia [RC15].
More...
template<typename T>
struct xenium::left_right< T >
Generic implementation of the LeftRight algorithm proposed by Ramalhete and Correia [RC15].
The LeftRight algorithm provides the following advantages when compared to a read-write-lock:
- writers never block readers, i.e., read operations are wait-free (population oblivious)
- readers never block writers, i.e., the updated data is immediately visible to new readers.
This is comes at the cost of a duplication of the underlying data structure, which also means that update operations have to be applied to both instances.
- Template Parameters
-
template<typename T >
template<typename Func >
Performs a read operation on the active instance using the specified functor.
The functor func
is called for the currently active instance. The instance is passed to the functor as a const reference.
This method simply returns the result of the call to func
, i.e., the return type of this method corresponds to the return type of the func
;
- Template Parameters
-
- Parameters
-
- Returns
- the value returned by the call to
func