diff options
Diffstat (limited to 'src/libutil/sync.hh')
-rw-r--r-- | src/libutil/sync.hh | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/libutil/sync.hh b/src/libutil/sync.hh index e1d591d77..ff938d03f 100644 --- a/src/libutil/sync.hh +++ b/src/libutil/sync.hh @@ -7,22 +7,22 @@ namespace nix { -/* This template class ensures synchronized access to a value of type - T. It is used as follows: - - struct Data { int x; ... }; - - Sync<Data> data; - - { - auto data_(data.lock()); - data_->x = 123; - } - - Here, "data" is automatically unlocked when "data_" goes out of - scope. -*/ - +/** + * This template class ensures synchronized access to a value of type + * T. It is used as follows: + * + * struct Data { int x; ... }; + * + * Sync<Data> data; + * + * { + * auto data_(data.lock()); + * data_->x = 123; + * } + * + * Here, "data" is automatically unlocked when "data_" goes out of + * scope. + */ template<class T, class M = std::mutex> class Sync { |