Add lttng::locked_reference
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 16 May 2022 21:50:08 +0000 (17:50 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 13 Jun 2022 20:34:46 +0000 (16:34 -0400)
commita3a562552968a6d6787366d6e61ab3d35863fd5a
treed17775393c9839266028e4ba17b1f117a56ad85e
parent84083c3c07b8c1f6320963c395d9c4a9012cdb44
Add lttng::locked_reference

A locked reference is a wrapper that allows functions to return a
protected/synchronized version of an object. My immediate use-case for
this helper is making it easier to call functions that return an
rcu-protected object (require the caller to hold the RCU reader lock for
the duration of its use of that object) in an exception safe manner.

As such, these functions can now return
lttng::locked_reference<MyType, lttng::urcu::unique_read_lock> which
ensures the RCU reader lock is held for as long as the object is used.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I9f4b7f918ba01491d3de14a1a570c83586f407ae
src/common/Makefile.am
src/common/locked-reference.hpp [new file with mode: 0644]
This page took 0.0256 seconds and 4 git commands to generate.